h****t 发帖数: 160 | 1 Fortran calls C++ functions:
in Fortran, the arguements are passed by reference,
in C++ prototype, the arguements can be declared as
pointer generally. I also tried passing reference in C++,
it works. (Here only consider a single unit built-in data type, e.g. real,
integer)
My question is: why it works for both passing reference and passing pointer?
(ONLY test on FC4, intel fc/cc 9.0)
Gao shou qing jie shi yi xia.....
3x. | s**i 发帖数: 381 | 2 IMHO, reference is essentially the same as pointers, since it is passing the
address not the value
【在 h****t 的大作中提到】 : Fortran calls C++ functions: : in Fortran, the arguements are passed by reference, : in C++ prototype, the arguements can be declared as : pointer generally. I also tried passing reference in C++, : it works. (Here only consider a single unit built-in data type, e.g. real, : integer) : My question is: why it works for both passing reference and passing pointer? : (ONLY test on FC4, intel fc/cc 9.0) : Gao shou qing jie shi yi xia..... : 3x.
| h****t 发帖数: 160 | 3 why lots of programmer are using pointer instead of reference?
I think refernece is better than pointer if only passing int, double ... data
type.
【在 s**i 的大作中提到】 : IMHO, reference is essentially the same as pointers, since it is passing the : address not the value
| s***t 发帖数: 113 | 4 It looks nicer to use reference than pointers, plus you do not need to
dereference pointers all the time.
data
【在 h****t 的大作中提到】 : why lots of programmer are using pointer instead of reference? : I think refernece is better than pointer if only passing int, double ... data : type.
| s***t 发帖数: 113 | 5 It looks nicer to use reference than pointers, plus you do not need to
dereference pointers all the time.
data
【在 h****t 的大作中提到】 : why lots of programmer are using pointer instead of reference? : I think refernece is better than pointer if only passing int, double ... data : type.
|
|