Reputation: 962
Having brain spasm this morning. Can't remember the GNU compiler option to flag
if (a = b)
as a warning/error because it is an assignment and not a condition.
Upvotes: 1
Views: 146
Reputation: 67721
The easiest way is to enable all warnings and see what is reported:
int main(int argc, char **argv){
if(argc=0) ;
}
compile with -Wall
you will get the warning:
<source>: In function 'int main(int, char**)':
<source>:3:12: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
3 | if(argc=0) ;
| ~~~~^~
Compiler returned: 0
So the option is: -Wparentheses
Upvotes: 3