News for hackers. Stuff that matters.
Re:Undefined behavior in C is a reading error by ynik on Thursday May 20, 2021 @03:28PM (#27225891)
> For example, if signed integer overflow yielded an unspecified result rather than causing undefined behavior, I wonder if any implementations would be adversely affected.

You don't need to wonder. You can use -fwrapv to make signed integer overflow defined behavior.

C++20 introduced the guarantee that signed integers are two's complement. The original version of that proprosal also defined the behavior on overflow; but that part was rejected (signed integer overflow remains UB): http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p090... So at least the committee seems to think that the performance advantages are worth it.

There are no comments on this comment yet.