> On Dec 8 15:34 Ulrich Deiters wrote (shortened): >> Interesting! The incriminated C code looked perfectly innocent >> to me (if the incrementing operation is carried out after all >> assignments, as it should, there is no ambiguity). > > Perhaps "ambiguous" is not exactly the right word because > in a textbook about C I read that '++' and '--' are not allowed > on the left side of '=' (e.g. x++ = 1; is not allowed) and in > this case the compiler should complain regarding "lvalue".
Your example is not representative: The original has *p++ as lvalue, not p++, so *p is assigned and not p (and p is post-incremented). I've seen a lot of code that does *x++ = *y++ (to copy something) and I've never seen a compiler complain about that. I agree that the solution proposed earlier is a bit cleaner (and probably easier to understand). Kind regards, Bertrik
