From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I3WTf-0004lB-Jx for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:18:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I3WTe-0004kg-Kb for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:18:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I3WTe-0004kO-AR for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:18:30 -0400 Received: from mail.sysgo.com ([62.8.134.5]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I3WTd-0006GK-S8 for qemu-devel@nongnu.org; Wed, 27 Jun 2007 08:18:30 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.sysgo.com (Postfix) with ESMTP id BCC4BCC179 for ; Wed, 27 Jun 2007 14:18:26 +0200 (CEST) Received: from donald.sysgo.com (unknown [172.20.1.30]) by mail.sysgo.com (Postfix) with ESMTP id 8FCFFCC175 for ; Wed, 27 Jun 2007 14:18:26 +0200 (CEST) Received: from mag-lap.sysgo.com (mag-lap.sysgo.com [172.22.7.12]) by donald.sysgo.com (Postfix) with ESMTP id 592382E42C3 for ; Wed, 27 Jun 2007 14:18:26 +0200 (CEST) Date: Wed, 27 Jun 2007 14:18:26 +0200 (CEST) From: Marius Groeger Sender: mag@sysgo.com Subject: Re: [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts In-Reply-To: <200706271220.36377.jseward@acm.org> Message-ID: 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 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 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. :-) Regards Marius -- Marius Groeger SYSGO AG Embedded and Real-Time Software Voice: +49 6136 9948 0 FAX: +49 6136 9948 10 www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com Handelsregister: HRB Mainz 90 HRB 8066 Vorstand: Knut Degen, Robert Kaiser, Detlev Schaadt Aufsichtsratsvorsitzender: Dr. Thomas Hoch USt(VAT)-Id-Nr.: DE 149062328