Is integer overflow defined?

Timon Gehr timon.gehr at gmx.ch
Thu Sep 1 09:44:48 PDT 2011


On 09/01/2011 06:20 PM, Sean Eskapp wrote:
> Is integer overflow defined (for instance, as being mod 2^size)?

I am quite sure that all operations are defined as operations on two's 
complement integers, which would mean overflow is defined, but I cannot 
find the respective part of the specification...

 > Can I reliably say that -long.min == 0L?

Well no, -long.min == long.min .

according to TDPL p53., that fact is defined. (unary minus: -x == ~x+1)


More information about the Digitalmars-d-learn mailing list