Interfacing with c and platform dependent sizes

simendsjo simen.endsjo at pandavre.com
Fri Feb 25 17:16:31 PST 2011


On 26.02.2011 02:06, bearophile wrote:
> simendsjo:
>
>> So.. A long in C is the same as the platform size? And long long doesn't
>> exist in 64 bit?
>
> In D the size of int/uint is 32 bits and long/ulong is 64 bits.
>
> In C the size of int, unsigned int, long, long long int, unsigned long long int, etc are not fixed, the change according to the CPU. sizeof(int)<= sizeof(long)<= sizeof(long long).
>
> A help:
> http://www.digitalmars.com/d/2.0/phobos/std_stdint.html
>
> Bye,
> bearophile

Ouch.. Any tips on porting C code that would work nicely with a 
transition to 64 bit?
Should I change all long and int to int_atleast_32_t and long long to 64?


More information about the Digitalmars-d-learn mailing list