Prefer Signed or Unsigned in D?

John Carter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 2 23:02:04 PDT 2015


On Wednesday, 2 September 2015 at 21:43:17 UTC, ponce wrote:

> Additionally, I was said weeks ago on this NG that and signed 
> overflow in D is not actually Undefined Behaviour.

Interesting.. The reference is fairly terse on exactly what 
happens, is it more formally specified anywhere? In which case 
Elder's objection melts away for D and becomes explicitly "prefer 
signed for D, but don't mix".

> For integral operands, the *, /, and % correspond to multiply, 
> divide, and modulus operations. For multiply, overflows are 
> ignored and simply chopped to fit into the integral type.


More information about the Digitalmars-d-learn mailing list