2 ms·
>Somehow the author seems to think that this is not what the wording intended, but they also fail to explain what they think should happen here. What "should"
by Jiro 5y ago
>Somehow the author seems to think that this is not what the wording intended, but they also fail to explain what they think should happen here.
What "should" happen is that the implementation-defined behavior in the assert matches the implementation-defined behavior in the calculation. That is, assert(a+100>a) should produce the same result as
int x = a + 100;
int y = a;
if (x > y)
;
else
printf("assertion failed\n");
- richardwhiuk 5y agoThat behaviour is no less undefined in the process of overflow.
- Jiro 5y agoOkay, then let's rephrase without a code example: The implementation-defined behavior in the assert should produce "true" if and only if the number printed for x+100 (also using implementation-defined behavior) is always larger than the number printed for x.