On Wed, May 27, 2009 at 09:24:17PM +0200, Wojciech Puchar wrote:
> > I haven't looked at the ZFS code but this sort of thing is exactly why
> > all code I write uses int8_t, int16_t, int32_t, uint8_t, ... even when
> > the first thing I have to do with a new compiler is to work out the
> > proper typedefs to create them.
> int, short and char are portable, 

Not completely, at least as far as C is concerned. I'd say that char and
long are portable, but not short and int.

According to K&R (and I don't think this has changed in later
standards), a char is defined as one byte. Short, int and long can vary
but short and int must be at least 16 bits, and a long must be at least
32 bits. Additionally a short may not be longer than an int which may
not be longer than a long. But the size of an int depends on hardware
platform and compiler data model.

R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

Attachment: pgp4s0ze2UDGA.pgp
Description: PGP signature

Reply via email to