FreeBSD & Software RAID
Roland Smith
rsmith at xs4all.nl
Wed May 27 20:08:10 UTC 2009
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.
Roland
--
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090527/618dbb1e/attachment.pgp
More information about the freebsd-questions
mailing list