News for hackers. Stuff that matters.
Re:C23 Implications for C Libraries by zajio1am on Monday November 21, 2022 @03:01PM (#33697154)
> This also means they could define integer overflow as 2's complement rollover, which is almost universal but is still considered undefined behavior.

No, they should not. Integer overflow is in most cases logic error, like division by zero or NULL pointer dereference, so it should stay undefined.

Re:C23 Implications for C Libraries by pantry-man on Monday November 21, 2022 @03:27PM (#33697477)
It can still be well defined behaviour and still an error
Re:C23 Implications for C Libraries by marssaxman on Monday November 21, 2022 @09:03PM (#33700866)
That's only true for the relatively recent and generally unhelpful "nasal demons" interpretation of undefined behavior; under the older concept, which is more like "do whatever the sensible thing would be on the target platform", rollover is probably just what you want.
Re:C23 Implications for C Libraries by zajio1am on Tuesday November 22, 2022 @08:25AM (#33705478)
Distinction between undefined, unspecified, and implementation-defined is already in ISO C99 specification and is rather specific:

"NOTE: Possible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (...), to terminating a translation or execution (...)."

> which is more like "do whatever the sensible thing would be on the target platform"

That is a meaning of 'implementation-defined' in C parlance.

Re:C23 Implications for C Libraries by marssaxman on Tuesday November 22, 2022 @09:56AM (#33706473)
I am familiar with the verbiage in the specification. My contention is that the currently popular tendency for C compilers to generate code which behaves in ways that are absurd and unpredictable, on the grounds that you shouldn't have been doing that anyway, is an unhelpful indulgence on the part of the compiler engineers.