Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2009 15:06:45 -0500
From:      David Kelly <dkelly@hiwaay.net>
To:        Wojciech Puchar <wojtek@wojtek.tensor.gdynia.pl>
Cc:        FreeBSD-Questions@freebsd.org
Subject:   Re: FreeBSD & Software RAID
Message-ID:  <20090527200645.GA11584@Grumpy.DynDNS.org>
In-Reply-To: <alpine.BSF.2.00.0905272123120.54285@wojtek.tensor.gdynia.pl>
References:  <4A1AA3DC.5020300@network-i.net> <200905271048.27837.kirk@strauser.com> <alpine.BSF.2.00.0905271832320.53013@wojtek.tensor.gdynia.pl> <200905271152.34237.kirk@strauser.com> <20090527190230.GB9937@Grumpy.DynDNS.org> <alpine.BSF.2.00.0905272123120.54285@wojtek.tensor.gdynia.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
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, only other things must be defined this 
> way.

No, they are not portable. "int" is 16 bits on many systems I work with.
char is sometimes signed, sometimes not. uint8_t is never signed and
always unambiguous.

> int8_t int16_t is just unneeded work. anyway - it's just defines, having 
> no effect on compiled code and it's performance.

No, they are not "just defines", I said "typedef". Typedef is subject to
stricter checking by the compiler.

Packing and alignment in structs is a big portability problem.

-- 
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090527200645.GA11584>