Subject: Re: C Language Standard(s)
To: None <current-users@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 12/22/1995 10:16:21
>> It is permissible for sizeof (long) to be less than sizeof (int),

> Did you say this backward?  K&R2 says (sect 2.2) that "int [...] is
> no longer than long".  I can't find the relevant section in ANSI, but
> I'm sure it concurs.

Yes and no.  int has to be no longer than long in terms of data storage
capacity.  No restriction is placed on their relative sizes in terms of
amount of memory occupied.  It would be legal - if somewhat bizarre -
to implement "int" as a nine-byte object of which only four bytes are
used and "long" as an eight-byte object of which only six bytes are
used (where "byte" might as well be assumed to be 8 bits).  Then
sizeof(int)=9, sizeof(long)=8, and yet all the language requirements
are still satisifed.

It's still not clear to me how sizeof(long)<sizeof(int) could ever be
useful, even to implementors, but that probably just means I haven't
thought about it enough.

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu