Undefined behaviors & Clang 3.3

Walter Bright newshound2 at digitalmars.com
Fri Jun 21 14:01:14 PDT 2013


On 6/21/2013 8:51 AM, qznc wrote:
> The D definition mirrors what modern PC architectures do and hence can be
> compiled efficiently there. C avoids coupling with any architecture hence
> "undefined".
> What architectures do not wrap around?

C is a very old language, and supported many architectures that no longer exist, 
such as ones-complement machines, machines with 10 bit bytes, weird floating 
point formats, EBCDIC, 16 bit CPUs, etc. A lot of C code tries to be "portable" 
to all these no-longer-existing machines, and a lot of effort is wasted.

But D has the luxury of taking advantage of the fact that things have converged 
on 2s-complement, IEEE 754 floating point, 8 bit bytes, Unicode, etc.

This means we can now nail down many implementation-defined and undefined behaviors.


More information about the Digitalmars-d mailing list