4 ms·
I always compile C code this way, so it warns me about that particular type of error: gcc -c -Wall -Werror -ansi ... You may not have to use all of those op
by fexl 15y ago
I always compile C code this way, so it warns me about that particular type of error:
gcc -c -Wall -Werror -ansi ...
You may not have to use all of those options, I'm not sure. The error message is:
"error: suggest parentheses around assignment used as truth value"
I find that very helpful.
- Jach 15y agoYou forgot "-pedantic" and "-Wextra". =P (And possibly a few more one-offs that aren't contained in the groups.) Though the key flag there to make it warn is -Wall, so you can still compile with c99 and avoid the -ansi flag. Pretty much any compiler or language worth its salt that allows assignment in conditionals with the equals sign (so Python, Lisp are out) will warn you about it.