Re: returning lvalue in C vs C++



On 2006-03-29, Phlip <phlip2005@xxxxxxxxx> wrote:
Ben C wrote:

f().x = 200;    /* "invalid lvalue" in C, but not in C++ apparently */

Consider the general scheme of C++, and specifically its overloaded
operators.

x.operator=() (figuratively) could have a side-effect that your code depends
on. So regardless where 'thing' appears, thing.x is accessible as an
lvalue.

It would be thing.operator=() but I see the point.

I did think of that, but I'm not sure it's the answer.
.