Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 25 Jan 2013 07:29:40 -0600
From: Rob Landley <rob@...dley.net>
To: musl@...ts.openwall.com
Cc: musl@...ts.openwall.com
Subject: Re: Make bits/wchar.h correct for all architectures (bug
 15036) (fwd)

On 01/19/2013 10:37:21 PM, Rich Felker wrote:
> On Sat, Jan 19, 2013 at 11:25:59AM -0800, Isaac Dunham wrote:
> > On Sat, 19 Jan 2013 08:58:40 -0500
> > Strake <strake888@...il.com> wrote:
> >
> > >
> > > On 18/01/2013, Rich Felker <dalias@...ifal.cx> wrote:
> > > > I think the same issues apply to musl, and the solution seems  
> very
> > > > elegant. Maybe we can apply the same thing. What do you think?
> > >
> > > What if int is not 32-bit?
> >
> > Not possible on a (current) POSIX system, to the best of my  
> knowledge.
> > Also not compatible with any glibc or LSB abi, or any Linux port.
> >
> > In other words: Unless you're planning to port musl to ELKS or
> > Win16/Win64, you're joking. And I would venture to say that you
> > would be joking in those cases, too.
> 
> I think Strake's concern was not about 16-bit int (which POSIX
> precludes) but rather the possibility of 64-bit int or such. For
> better or worse, there are many practical reasons int should never be
> larger than 32-bit, the most serious of which are connected to the
> side effects of integer promotion rules. And in any case, all relevant
> systems (keep in mind this is musl, not an application, so it can
> assume its own implementation details) have 32-bit int and always
> will.

There is an actual standard on this, it's called LP64 from unix.org,  
and Linux (and MacOS X, and the BSDs) explicitly support it:

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

LP64 says that "long is the same size as pointer". It also says that  
char is 8 bits, short is 16 bits, int is 32 bits. (And that long long  
is at least 64 bits, but never says long long can't be LARGER than 64  
bits, although nothing is so far that I've found.)

Windows does not support LP64, for insane legacy reasons described here:
http://blogs.msdn.com/oldnewthing/archive/2005/01/31/363790.aspx

But I believe they're pretty much the only one still shipping that  
doesn't.

Rob

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.