int always 32 bits on all platforms?
sean at invisibleduck.org
Wed Oct 21 15:52:47 PDT 2009
> How can/does D guarantee that "int" will always be 32 bits on all platforms?
> Does this mean that D won't work on some platforms? Why is integer width so
> ambiguous in C/C++? (I am using "platform" as equivalent to
int can be any width D wants it to be and everything works great so long as you're only calling D functions. The conflict comes when calling C functions, and there's nothing in the language for addressing this. Instead, it's a library issue. For example, Druntime's core.stdc.config defines "c_long" and "c_ulong" types for interfacing with C, since these types change width across 32 and 64-bit platforms. There's been no attempt to deal with odd-sized int or other types though. That just isn't an issue on common platforms.
More information about the Digitalmars-d