5 ms·
What about while? while(flag = 0) looks like a similar error, but while(foo = read()) is a common idiom.
by rcfox 16y ago
What about while? while(flag = 0) looks like a similar error, but while(foo = read()) is a common idiom.
- brownleej 16y agoI think some compilers give a warning on while(foo = read()) but not on while((foo = read())).
- CamperBob 16y agoIt's not the choice of keyword that (should) trigger the warning. It's the simple fact that an expression that evaluates to boolean contains an '='. This potential error is trivial for any compiler to flag.