qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts


From: Marius Groeger
Subject: Re: [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts
Date: Wed, 27 Jun 2007 14:18:26 +0200 (CEST)

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 <address@hidden>
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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]