by huhtenberg · 13y ago · 0 comments
huh@px:/tmp$ cat a.c
int main(int argc, char *argv[]) {
if (argc = 0)
return 1;
return 0;
}
huh@px:/tmp$ gcc -Wall a.c
a.c: In function 'main':
a.c:2: warning: suggest parentheses around assignment used as truth valueBut this is a such commonly-recognized pitfall that I actually don't know a single modern production compiler that does not generate this warning.
(edit) Just checked 4.7.1 and it generates the warning.