FreeBSD & Software RAID
    David Kelly 
    dkelly at hiwaay.net
       
    Wed May 27 20:06:48 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, 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 at HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.
    
    
More information about the freebsd-questions
mailing list