4 ms·
Uhh, perhaps I'm not parsing your claim correctly, but that warning most certainly does exist in gcc. $ gcc -Wall test.c test.c: In function ‘main’: test
by zoodlep 9y ago
Uhh, perhaps I'm not parsing your claim correctly, but that warning most certainly does exist in gcc.
$ gcc -Wall test.c
test.c: In function ‘main’:
test.c:6:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (a = b) {
^
Parentheses here would be superfluous, but would perhaps confirm you really intended to assign (i.e. used = instead of ==).
- asveikau 9y agoPutting parens around that example, while not strictly needed, also makes it harder to forget to add them if you later add an && or || to the conditional. So I am in favor.
- user5994461 9y agoYou realize that you have an assignment instead of a comparison? The warning here couldn't be more justified. In a decent language, this should be a hard error.