-Kevin Ballard
--
Kevin Ballard
http://kevin.sb.org
kbal...@gmail.com
C++ doesn't let you do this either.
You can only take the address of something that
can be assigned to, and just like you can't say
f() = 1
you can't use &f() either.
$ n x.c
1 int f() { return 0; }
2 int *g() { return &f(); }
$ gcc x.c
x.c: In function 'g':
x.c:2: error: invalid lvalue in unary '&'
$ n x.cc
1 int f() { return 0; }
2 int *g() { return &f(); }
$ gcc x.cc
x.cc: In function 'int* g()':
x.cc:2: error: invalid lvalue in unary '&'
$
Russ
prog.cpp: In function ‘int main()’:
prog.cpp:22: warning: taking address of temporary
output: 78