I am a bit baffled that I managed to accidentally write code equivalent to this one
int a=a; // there is not a declared before this line
and the compiler happily compiled it - both gcc and clang, which are very standard-conforming and have good diagnostics. (With -Wall
, gcc 4.8 warns about uninitialized variable; clang does not).
I thought the RHS of the assignment will be evaluated prior do LHS, hence causing a
to be undefined on the RHS. Can I have some simple clarification about why is this syntactically legal?