Undefined macros evaluate to zero, so when checking for a smaller value,
we need to include the case when the macro is undefined.
Details
- Reviewers
aaron.ballman iana
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Undefined macros evaluate to zero, so when checking for a smaller value, we need to include the case when the macro is undefined.
The code being changed already checks defined(__cplusplus) so there no undefined macro value being tested. What's more, if __cplusplus is not defined, we wouldn't even get into this block because we'd have hit line 19 instead. I think the current form is easier to read given the subsequent comment talking about being in C++98 mode (which would be weird to consider for when __cplusplus is not defined), even if the test for defined(__cplusplus) isn't strictly needed.
Ah, I didn't see that either. Can we just lose the defined on line 26 then? It's redundant and little confusing.
I'm fine dropping it (ever so slightly less work for the preprocessor to do in this file), but I don't see what the confusion is with checking whether __cplusplus is defined before testing its value, so I'm also fine with leaving it as-is.