On Aug 21, 10 02:12, Walter Bright wrote:
[snip]

You're conflating two different things here - undefined behavior and
behavior on overflow. The Java spec says that integer overflow is
ignored, for example.

In C++, overflow behavior is undefined because C++ still supports
ones-complement arithmetic. Java and D specify integer arithmetic to be
2's complement. Java defined left shift to, not surprisingly, match what
the x86 CPU does. This, of course, will conveniently not result in any
penalty on the x86 for conforming to the spec.

I believe D requires signed integers be represented in 2's complement, but the specification didn't document it (grepping 'complement' in phobos/docsrc gives nothing related).

Reply via email to