C++ Logo

std-proposals

Advanced search

[std-proposals] Integers are all two's complement, so now overflow is predictable

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Fri, 7 Apr 2023 12:21:42 +0100
Since the latest Standard now dictates that signed integers are
implemented in two's complement, can we now do away with signed
overflow being undefined behaviour?

How about the following being true for all compilers?

     int i = INT_MAX;

    ++i;

    static_assert( INT_MIN == i );

Received on 2023-04-07 11:21:54