A******g 发帖数: 612 | 1 A C/C++ question, I know
int* foo(void) foo
will return a pointer to int type
how about
int &foo(void)
what does it return?
Thank a lot! |
N***m 发帖数: 4460 | 2 reference to int?瞎猜得,哈哈
【在 A******g 的大作中提到】 : A C/C++ question, I know : int* foo(void) foo : will return a pointer to int type : how about : int &foo(void) : what does it return? : Thank a lot!
|
g*********s 发帖数: 1782 | 3
not verifying its correctness. but if it's right, what does this line
mean?
【在 A******g 的大作中提到】 : A C/C++ question, I know : int* foo(void) foo : will return a pointer to int type : how about : int &foo(void) : what does it return? : Thank a lot!
|
N***m 发帖数: 4460 | 4 I guess he means int (*foo)(void)=foo;
【在 g*********s 的大作中提到】 : : not verifying its correctness. but if it's right, what does this line : mean?
|
g*********s 发帖数: 1782 | 5 self-assignment?
【在 N***m 的大作中提到】 : I guess he means int (*foo)(void)=foo;
|
N***m 发帖数: 4460 | 6 well, it is sth like:
int foo()
{
return 1;
}
int main()
{
int (*foo)(void)=::foo;
foo();
}
【在 g*********s 的大作中提到】 : self-assignment?
|
g*********s 发帖数: 1782 | 7 i turn on shadow warning and always avoid such code.
【在 N***m 的大作中提到】 : well, it is sth like: : int foo() : { : return 1; : } : int main() : { : int (*foo)(void)=::foo; : foo(); : }
|
N***m 发帖数: 4460 | 8 that's for sure. the demo code is to just try to figure out what lz means.
【在 g*********s 的大作中提到】 : i turn on shadow warning and always avoid such code.
|