Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Nov 1995 12:05:45 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        peter@taronga.com (Peter da Silva)
Cc:        hackers@FreeBSD.ORG, terry@lambert.org
Subject:   Re: How long is long?
Message-ID:  <199511241905.MAA10078@phaeton.artisoft.com>
In-Reply-To: <199511241510.JAA12572@bonkers.taronga.com> from "Peter da Silva" at Nov 24, 95 09:10:07 am

next in thread | previous in thread | raw e-mail | index | archive | help
> Terry Lambert  <terry@lambert.org> wrote:
> >That's a bug in the standard in not having mechanisms for obtaining
> >sized types.  For a 64 bit int (requiring a 64 bit long), short is
>                                              ^^-- 128
                                                    ^^^-- 64
The size of long shall be greater than or equal to the sizeof int.  Your
128 says "greater than" and ignores "equal to".

> >either 16 or 32 bits (undefined) and we lose access to either 32 or
> >16 bit types (respectively).
> 
> What architecture requires a 64 bit (int)?

Any architecture where 64 bits is the bus transfer size and the registers
are 64 bits or larger.  It's defined as the "natural type" for the machine.

But I was assuming a 64 bit int, and it was the int requiring the 64
bit long, not anything requiring a 64 bit int.

My complaint is about the long >= int requirement on longs.

> IMHO, DEC did exactly the right thing making int 32 bits and long 64 bits,
> given the history of the language, but IMHO the original BSD port to the
> VAX should have done the same thing, rather than keeping it 32 bits for
> easier porting of PDP-11 code.
> 
> Long doesn't and shouldn't mean "32 bits".

Maybe not.  But *something* should mean "32 bits".

The problem is that with a 64 bit int (which, despite your opinion of
DEC and grandfathering old software, is correct for the Alpha):

int == 64	:==	long == 64
short == 32	||	short == 16
char == 8

You lose access to either 32 bit or 16 bit sized types.

Period.

What about existing on-disk data?


ANSI doesn't allow "long long" or "quad".



					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511241905.MAA10078>