avatar
h*t
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.
avatar
s*i
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.

avatar
h*t
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

avatar
s*t
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.

avatar
s*t
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.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。