From owner-freebsd-questions@FreeBSD.ORG Wed May 27 20:06:47 2009 Return-Path: Delivered-To: FreeBSD-Questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8022F1065670 for ; Wed, 27 May 2009 20:06:47 +0000 (UTC) (envelope-from dkelly@Grumpy.DynDNS.org) Received: from smtp.knology.net (smtp.knology.net [24.214.63.101]) by mx1.freebsd.org (Postfix) with ESMTP id 1717E8FC1E for ; Wed, 27 May 2009 20:06:46 +0000 (UTC) (envelope-from dkelly@Grumpy.DynDNS.org) Received: (qmail 1774 invoked by uid 0); 27 May 2009 20:06:45 -0000 Received: from unknown (HELO Grumpy.DynDNS.org) (24.42.224.110) by smtp7.knology.net with SMTP; 27 May 2009 20:06:45 -0000 Received: by Grumpy.DynDNS.org (Postfix, from userid 928) id 0789228435; Wed, 27 May 2009 15:06:45 -0500 (CDT) Date: Wed, 27 May 2009 15:06:45 -0500 From: David Kelly To: Wojciech Puchar Message-ID: <20090527200645.GA11584@Grumpy.DynDNS.org> References: <4A1AA3DC.5020300@network-i.net> <200905271048.27837.kirk@strauser.com> <200905271152.34237.kirk@strauser.com> <20090527190230.GB9937@Grumpy.DynDNS.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: FreeBSD-Questions@freebsd.org Subject: Re: FreeBSD & Software RAID X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: FreeBSD-Questions@FreeBSD.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 20:06:48 -0000 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.