qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>
Subject: Re: [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts
Date: Fri, 6 Jul 2007 15:20:59 -0400	[thread overview]
Message-ID: <200707061520.59866.rob@landley.net> (raw)
In-Reply-To: <f43fc5580706270326l4005852ax2a5e0cbbedddedac@mail.gmail.com>

On Wednesday 27 June 2007 06:26:54 Blue Swirl wrote:
> On 6/26/07, Paul Brook <paul@codesourcery.com> 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.

  parent reply	other threads:[~2007-07-07  5:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-25 20:16 [Qemu-devel] [PATCH, RFC] More than 2G of memory on 64-bit hosts Blue Swirl
2007-06-25 20:26 ` Michal Schulz
2007-06-25 20:52   ` Blue Swirl
2007-06-25 21:08     ` Michal Schulz
2007-06-26  2:03     ` Karl Magdsick
2007-06-26  8:00       ` Thiemo Seufer
2007-06-26 13:54       ` Paul Brook
2007-06-27 10:26         ` Blue Swirl
2007-06-27 10:32           ` Julian Seward
2007-06-27 11:10             ` Thiemo Seufer
2007-06-27 11:20               ` Julian Seward
2007-06-27 12:18                 ` Marius Groeger
2007-06-27 12:32                   ` Thiemo Seufer
2007-07-06 19:20           ` Rob Landley [this message]
2007-06-29 14:26       ` Gwenole Beauchesne
2007-06-25 20:28 ` Thiemo Seufer
2007-06-25 20:53   ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707061520.59866.rob@landley.net \
    --to=rob@landley.net \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).