casting on 64/32-bit environment
Andrew Haley
aph-gcc@littlepinkcloud.COM
Sun Oct 14 02:48:00 GMT 2007
Miles Bader writes:
> Holger Eitzenberger <holger@eitzenberger.org> writes:
> >> Dose anyone have a reasonable explanation about that?
> >
> > make sure to use 'unsigned long' instead of 'unsigned int', as only the
> > first one will be 64bit in a 64bit environment, the latter still will
> > be 32bit.
>
> You can't really assume this -- apparently on ms-windows "long" is
> still 32 bit, even in a "64-bit" environment (stupid, I agree, but
> I guess MS has too much badly written code that they don't want to
> break...).
Indeed. ptrdiff_t and size_t and intptr_t are the types to use,
depending on exactly what is wanted.
Andrew.
More information about the Gcc-help
mailing list