3 ms·
-Wparentheses is the one that prevents if (password_ok = true) { ...
by poizan42 10y ago
-Wparentheses is the one that prevents if (password_ok = true) { ...
- byuu 10y agoI'm aware, but that's perfectly legal code. Every warning case I've described can result in bugs, but the problem is when you intended to do what you did, you can't get the compiler to shut up about it there. For the warnings I disable, they're things I do all the time. I can't recall ever typing = when I meant ==; whereas I combine assign + test into a single statement very frequently. The warnings I keep on are the ones where I'd never want to do those things, and it'd never be proper code. Those are great warnings to have in place.
- Too 10y agoif (password_ok = true) is not perfectly legal code in any serious project. It's not worth the risk to allow it just to save one line of code.