[ub] A proposal to define signed overflow submitted?

JF Bastien cxx at jfbastien.com
Mon Feb 19 06:52:00 CET 2018


On Sun, Feb 18, 2018 at 9:48 PM Lawrence Crowl <Lawrence at crowl.org> wrote:

> On 2/16/18, Freek Wiedijk <freek at cs.ru.nl> 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.


No disagreement. I wrote the paper the way I did because I want that
discussion to conclude what the default should be, and what the more
verbose alternate should be: UB or two’s complement?

There are many ways we can design this. I proposed the one I find more
palatable, expecting others to disagree.

It would be great for a solid reasoning to emerge on the design.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/ub/attachments/20180219/07de4161/attachment.html 


More information about the ub mailing list