B
Ben Bacarisse
[I was inclined to snip all this since I can't see the connection, but
that could be because I just don't get your point. I'll leave it in,
in case your remarks do apply to what I said.]
Er, yes, but so what? I don't get the point you are making. The
standard says which forms of expression are lvalues and which are not,
but lvalues can be used in non-lvalue ways. In the above, 'c' is an
lvalue sub-expression but it is used in a way that does not depend on
it being one.
that could be because I just don't get your point. I'll leave it in,
in case your remarks do apply to what I said.]
I think it's interesting that OP had said upthread:
"However some one said to me it is not valid C syntax as
same variable cannot be l-value and r-value in same statement."
I think the actual case is that the
same *expression* cannot be l-value and r-value in same statement,
which is something that I don't think that I had ever considered
before.
a=b=c;
means the exact same thing as:
((a) = ((b) = (c)));
Er, yes, but so what? I don't get the point you are making. The
standard says which forms of expression are lvalues and which are not,
but lvalues can be used in non-lvalue ways. In the above, 'c' is an
lvalue sub-expression but it is used in a way that does not depend on
it being one.