Integer overflow and underflow semantics

Don Clugston dac at nospam.com
Mon May 7 01:05:59 PDT 2012


On 05/05/12 06:57, Alex Rønne Petersen wrote:
> Hi,
>
> I don't think the language really makes it clear whether overflows and
> underflows are well-defined. Do we guarantee that for any integral type
> T, T.max + 1 == T.min and T.min - 1 == T.max?
>
> This is relevant in particular for GDC and LDC since they target a lot
> of weird architectures.
>

I think the reason that C makes no guarantees, was because of 
ones-complement machines (which had become very rare even by 1970).
Surely we can assume 2-s complement behaviour?


More information about the Digitalmars-d mailing list