Quantcast
Channel: User Peter - Reinstate Monica - Stack Overflow
Viewing all articles
Browse latest Browse all 239

Comment by Peter - Reinstate Monica on Is `(expression, lvalue) = rvalue` a valid assignment in C or C++? Why do some compilers accept/reject it?

$
0
0
@sleeptightAnsiC Oh, I see: the (...) expression is not an lavalue in C, but it desn't have to be -- xx[0] is an lvalue even if xx is not, cool! (As an aside, in C you could also revert the operands for the [] operator, i.e. (1,0)[arr] should work. Because indexing is defined as addition, and addition is commutative, indexing is commutative as well, with the expected, well-defined results. That makes it obvious that the left operand does not have to be an lvalue at all.)

Viewing all articles
Browse latest Browse all 239

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>