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: Rob Landley
Subject: Re: [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts
Date: Fri, 6 Jul 2007 15:20:59 -0400
User-agent: KMail/1.9.6

On Wednesday 27 June 2007 06:26:54 Blue Swirl wrote:
> On 6/26/07, Paul Brook <address@hidden> wrote:
> > The story behind this is that ISO C89 requires that "long" be at least as
> > big as a pointer (ie. "void *"). The actual requirement is that it be
> > possible to store a pointer in a standard integer type, and "long" is the
> > largest standard integer type.
> >
> > Unfortunately C99 relaxed this requirement, and allowed abominations like
> > the win64 ABI.
> >
> > This means you have a choice: Write standard conforming code (long) that
> > works on all known systems except win64, or use features that do't exist
> > on many systems. IIRC C99 types like intptr_t are not supported on
> > several fairly common unix systems.
>
> In that case I'll vote for unsigned long. I'd pass the issue to those
> doing a win64 port, if ever that happens.

The actual standards documents on this, by the way, are at:

The LP64 standard: http://www.unix.org/whitepapers/64bit.html
The LP64 rationale: http://www.unix.org/version2/whatsnew/lp64_wp.html

Upshot: on any Linux, char is 8 bits, short is 16, int is 32, and long is 32 
on 32-bit and 64 on 64-bit.  And you can rely on that.

Linux supports this standard on all target platforms.  As do MacOS X and the 
BSDs.

Windows doesn't actually have standards, but their rationale for LLP64 (a term 
they made up) was explained in a blog post from one of the developers: 
http://blogs.msdn.com/oldnewthing/archive/2005/01/31/363790.aspx

I'm unaware of anyone actually successfully deploying Win64 for anything (I 
know of a few test deployments, but they failed and were withdrawn), so the 
Win64 API being broken and unusable is largely an academic question. This 
doesn't affect Win32, which is what well over 99% of the Windows installed 
base uses.

Beyond that, C99 gives you int8_t through int64_t (and corresponding uint64_t 
types) that are also guaranteed sizes, and that part even works on Windows 
(as much as anything does).

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

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