TIOBE - C Coding Standard
|Synopsis:||Controlling expressions shall not contain assignments.|
|Isolating side-effects in expression statements helps the reader by making changes in state explicit, separating them from tests on that state. Implicit actions on behalf of an implementation are to be avoided for the sake of clarity. Modern compilers will optimise a comparison against zero in any case, defeating any arguments of efficiency.
if ( a = 1 ) /* WRONG - unexpected behaviour */
if ( a == 1 ) /* RIGHT */
if ( (fp = get_file()) != NULL ) /* WRONG - confusing */