3 ms·
if(IN_RANGE_CLOSED(dw_result,0,WHATEVER)) Build the appropriate model for IN_RANGE, and done. Has the benefit that you explicitly state the type of range (ope
by groby_b 15y ago
if(IN_RANGE_CLOSED(dw_result,0,WHATEVER))
Build the appropriate model for IN_RANGE, and done.
Has the benefit that you explicitly state the type of range (open|closed|half-open[LR]), so you'll be a bit more likely to think about the edge cases.
Is it painful? Yes. I'd rather take that pain than debugging crash reports, though. (YMMV - it certainly depends on what you are building, how large your audience is, and what the consequences of a crash are)
- georgieporgie 15y agoTo be honest, that's really ugly to me, and it requires me to remind myself of exactly what that macro is. I'm definitely not willing to change my code style solely to satisfy a static checker's zero-impact 'bug'.