[Zlib-devel] crc32 big/little endian

Vincent Torri vtorri at univ-evry.fr
Thu Apr 22 02:53:39 EDT 2010



On Thu, 22 Apr 2010, Rolf Kalbermatter wrote:

> Mark Adler <madler at alumni.caltech.edu> wrote:
>
>> How could long be less portable?  Every C compiler since the
>> beginning of time understands long, even with no header files
>> at all. Obviously I'm missing something here.
>
> Maybe because long on Windows 64bit is 32 bit while in Linux
> 64bit it is 64 bit??
>
> Most likely so that long doesn't change size between 32bit and
> 64bit Windows and they have the MSCVC type _int64 for 64bit integers.
>
> Not sure why GCC chose to change size between systems.

C ANSI (C89) specifies:

sizeof(char) = 1

sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)

and no change with signed or unsigned

that's all. Each compiler can do what it wants about the size of these 
types

Vincent Torri

  Before I
> assumed that int was meant to be the actual bitness integer and
> all other integer types would stay the same size no matter what,
> which of course never was entirely true for every single C compiler
> out there but still seemed like a good straw to hold on to.
>
> Rolf Kalbermatter
>
>
> _______________________________________________
> Zlib-devel mailing list
> Zlib-devel at madler.net
> http://mail.madler.net/mailman/listinfo/zlib-devel_madler.net
>
>




More information about the Zlib-devel mailing list