C++ Logo

sg12

Advanced search

Re: [ub] A proposal to define signed overflow submitted?

From: Lawrence Crowl <Lawrence_at_[hidden]>
Date: Sun, 18 Feb 2018 21:48:24 -0800
On 2/16/18, Freek Wiedijk <freek_at_[hidden]> wrote:
> Is there a good reason not to have it be implementation defined
> whether signed overflow is undefined or wrapping?

If integer overflow is undefined behavior, then it is wrong. Tools can
detect wrong programs and report them.

If integer overflow is wrapping, then one never knows whether or
not the programmer is relying on wrapper or would be surprised at
wrapping. No diagnostic is possible.

-- 
Lawrence Crowl

Received on 2018-02-19 06:48:26