From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I3Wil-0001zh-FJ for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:34:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I3Wij-0001wx-WD for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:34:07 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I3Wij-0001wr-RE for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:34:05 -0400 Received: from phoenix.bawue.net ([193.7.176.60] helo=mail.bawue.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I3Wij-0001wO-D2 for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:34:05 -0400 Received: from lagash (intrt.mips-uk.com [194.74.144.130]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bawue.net (Postfix) with ESMTP id A2F55B86C8 for ; Wed, 27 Jun 2007 14:32:54 +0200 (CEST) Received: from ths by lagash with local (Exim 4.67) (envelope-from ) id 1I3WhZ-0005SA-LB for qemu-devel@nongnu.org; Wed, 27 Jun 2007 13:32:53 +0100 Date: Wed, 27 Jun 2007 13:32:53 +0100 Subject: Re: [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts Message-ID: <20070627123253.GB15701@networkno.de> References: <200706271132.51360.jseward@acm.org> <20070627111012.GA15701@networkno.de> <200706271220.36377.jseward@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: From: Thiemo Seufer Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Marius Groeger wrote: > On Wed, 27 Jun 2007, Julian Seward wrote: > > > > > In Valgrind-world we use an alternative approach, which is to typedef > > > > a set of new integral types and use those exclusively, and not use the > > > > native 'int', 'long' etc. The new types have a single fixed meaning > > > > regardless of the host or guest and it is up to the configure script > > > > to set up suitable typedefs. At startup Valgrind checks the size and > > > > signedness of these types is as expected, so any configuration errors > > > > are caught. This has proved very helpful in porting to a number of > > > > platforms. > > > > So in this particular case we have the types UWord and Word > > (unsigned and signed machine words) which it is guaranteed are > > the same size as void*, on all platforms. > > > > We also capitalise the first letter of all type names as that > > makes the code easier to read and makes it obvious when you are > > inadvertantly using the native 'int', 'long' etc. > > FWIW, any C code defining such types with a "single fixed meaning" > should use very(!) distinct prefixes to keep those identifiers within > their own namespace. From what I can tell having done quite a lot of > porting and component integration of C code, capitalization is > definitely not enough to ensure self-containedness of your code. :-) Indeed. We have already host_ and target_ prefixes in some places, which are IMHO a natural choice for a naming convention. Thiemo