4 ms·
I think you are in agreement with the comment you are replying to.
by wyldfire 8y ago
I think you are in agreement with the comment you are replying to.
- paulddraper 8y agoThe comment suggested the standard make it implementation defined rather than undefined. There's not a meaningful difference here. Even today, an implementation may define unsigned overflow.
- wyldfire 8y agoOh, I see, I wonder if greenhouse_gas is suggesting a feature similar to sizeof() that can be used to portably adapt your program's design to the target's overflow capability.
- unwind 8y agoC language lawyer in training: sizeof is not a function. The parentheses are part of the operand and only needed for type names, to make them into cast expressions.
- Someone 8y agoYes, there is. Implementation defined means that a conforming implementation _must_ document its behavior. That means that programmers don’t have to use trial and error to figure out how the compiler behaves and don’t have to _hope_ they found all the corner cases.
- berti 8y agoAnd that is how we get #if defined(_THIS_THING_SOME_COMPILER_DEFINES) && !defined(__BUT_NOT_THIS_ONE_THAT_COMPILER_X_DEFINES) soup ;)
- greenhouse_gas 8y agoBetter than than silently ignoring an if guard preventing an overflow, and then overflowing anyways on addition.