Signed integer overflow undefined behavior or not?

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 13 01:10:45 PST 2015


On 13 Nov 2015 7:05 am, "Walter Bright via Digitalmars-d" <
digitalmars-d at puremagic.com> wrote:
>
> On 11/12/2015 4:43 PM, Ali Çehreli wrote:
>>
>> So the question is, do we support twos complement only, hence signed
overflow is
>> defined as wrap,
>
>
> Yes. I see no reason to support 1's complement.
>
> It's worth checking how LDC and GDC deal with this deep in their
optimizer - is it considering it undefined behavior?
>

We are not.  For gdc, the fwrapv flag is enabled by default.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20151113/7c2992d8/attachment-0001.html>


More information about the Digitalmars-d mailing list