int always 32 bits on all platforms?
AJ
aj at nospam.net
Wed Oct 21 23:06:17 PDT 2009
"Sean Kelly" <sean at invisibleduck.org> wrote in message
news:hbo3bv$2q25$1 at digitalmars.com...
> AJ Wrote:
>>
>> 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
>> CPU+OS+compiler).
>
> 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.
I had struct layout/size/alignment/member-alignment concerns.
More information about the Digitalmars-d
mailing list