4 ms·
I hope it doesn't warn for things like if(0 != (i = getValue()))
by ifdefdebug 11y ago
I hope it doesn't warn for things like
if(0 != (i = getValue()))
- chris_wot 11y agoI hope it does!
- PeCaN 11y agoWhy would that be a warning? It's quite clear what that code is doing and is a reasonably common C idiom.
- tspiteri 11y agoIt doesn't since the assignment is in brackets. You can also write if ((i = getValue()))
- deleted 11y ago[deleted]
- sigjuice 11y agoWhy not be absolutely sure? if (0 != (0 != (i = getValue())))
- ifdefdebug 11y agoI am aware of the redundancy, this was about the new warnings. If you can't do if(i = getValue()) without warning, I was wondering if assignments as a part of a larger expression would pass.