3 ms·
I believe they mean that if (foo = 0) ... generates a warning like this: warn.c:2: warning: suggest parentheses around assignment used as truth value
by shabble 13y ago
I believe they mean that
if (foo = 0) ...
generates a warning like this:
warn.c:2: warning: suggest parentheses around assignment used as truth value
which you should be paying attention to, in favour of yoda-comparisons in this particular holy war :)
- harrytuttle 13y agoI would but if you see the rest of the thread, my gcc isn't raising this as a warning! That in itself is sign that a mistake can be made without noticing.
- ajross 13y agoThe code in question (see the LWN link elsewhere in this discussion) actually had parens around the expression (in a context where they looked "normal") and wouldn't have generated a warning. That said, I agree with huhtenberg above that twisting the language conventions around to deal with this is never going to fix anything. Subtle code remains subtle in all languages, and subtle code is where security bugs lie. You can't fix "subtle" with a rulebook.