curly-brace-aphobic?
Randall Kern
randy at spoke.net
Tue Jan 30 11:43:38 EST 2001
"Quinn Dunkan" <quinn at groat.ugcs.caltech.edu> wrote in message
news:slrn97cu0u.eti.quinn at groat.ugcs.caltech.edu...
> If C++ allows 'f(x) = y;', then C++ is truly weird. What is *that*
supposed
> to mean? 'f(x)' returns a value, and assigning to a value makes no sense.
> You assign to variables, not values. I could understand '*(f(x)) = y;',
but
> the only way I can see to get 'f(x) = y;' to do what you want is to have
'f'
> return an lvalue.
int i = 0;
int& f(int x)
{
return i;
}
int main()
{
f(2) = 5; // the global i is now 5
}
The function f() has the return type 'int reference', like a pointer that
doesn't need to be dereferenced.
-Randy
More information about the Python-list
mailing list