3 ms·
> The #if statement replaces, after macro expansion, every remaining identifier with the pp-number 0. So #if static_cast<bool>(-1) is equivalent to #if 0<0>(-1)
by adzm 4y ago
> The #if statement replaces, after macro expansion, every remaining identifier with the pp-number 0. So #if static_cast<bool>(-1) is equivalent to #if 0<0>(-1), #if 0 > -1, and #if 1.
Wow, I have no idea why this would ever be done.
- jcelerier 4y agowell it's the consequence of #if SOME_STUFF evaluating to 0 if SOME_STUFF isn't defined
- kazinator 4y ago> I have no idea why this would ever be done. You'd never literally write #if static_cast<bool>(-1) but it could be the result of a macro expansion.
- sudosysgen 4y agoBecause the preprocessor doesn't know what static_cast is, so in an if it just evaluates to false as do any values that haven't been defined.