int always 32 bits on all platforms?

Walter Bright newshound1 at digitalmars.com
Wed Oct 21 16:30:27 PDT 2009


AJ wrote:
> How can/does D guarantee that "int" will always be 32 bits on all platforms?

The implementation on a platform must implement it that way.

> Does this mean that D won't work on some platforms?

You can make anything work on any platform - the tradeoffs are some may 
be too inefficient to be usable. For example, a PDP-10 has 36 bit words. 
I'd say a Ten isn't likely to get a D implementation.

> Why is integer width so ambiguous in C/C++? (I am using "platform" as equivalent to 
> CPU+OS+compiler).

Because C was developed for 16 bit computers where 'int' was efficiently 
implemented as 16 bits.



More information about the Digitalmars-d mailing list