/tmp>cat gcc-warn-assign.c int main(void) { int i,x,y; i=x=y=0; /* unintentional assignment inside if condition */ if (x=42) i++; if (x=y) i++; /* intentional assignment inside if condition, marked with extra parentheses */ if ((x=42)) i++; if ((x=y)) i++; return i; } /tmp>gcc -Wall -pedantic gcc-warn-assign.c gcc-warn-assign.c: In function ‘main’: gcc-warn-assign.c:6:2: warning: suggest parentheses around assignment used as truth value gcc-warn-assign.c:7:2: warning: suggest parentheses around assignment used as truth value /tmp>gcc --version gcc (GCC) 4.5.2 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. /tmp>