Signed integer overflow undefined behavior or not?

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 13 03:06:29 PST 2015


On Friday, 13 November 2015 at 10:20:53 UTC, Don wrote:
> Oh, I like that! That does seem to be the best of both worlds. 
> Then, as a QOI issue, the compiler can try to detect the error. 
> If it does not detect the error, it MUST provide the two's 
> complement result. It is not allowed to do any weird stuff.

That would be a silly restriction that nobody would need to care 
about.  If the user cannot assume wrapping then compiler vendors 
will make more aggressive optimizations available.



More information about the Digitalmars-d mailing list