tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: setsockopt() compat issue




On Oct 18, 2008, at 2:01 PM, Alan Barrett wrote:

On Sat, 18 Oct 2008, Manuel Bouyer wrote:
I think all NetBSD's current 64-bit platforms still use 32-bit ints
(it's longs and pointers that are 64-bit).

Arguably this is wrong, since int is supposed to be the machine's
native word size.  Why it was done this way I don't know - I didn't
make that choice and can't recall anything even hinting at why it was
made the way it was.

I think the main reason would be that otherwise, you wouldn't have a way
to declare a 32bits value:
char -> 8bits
short -> 16bits
int -> 32bits
long -> 64bits

Nothing in ANSI C99 prohibits a system from having extra types with
sizes in between the sizes of the standard char/short/int/long types.
For example, one could have a 32-bit "int32_t" even if short was 16 bits
and int was 64 bits.

People get very hung up on this for some reason and the standard is pretty open here.

char >= 8 bits

short/int >= 16 bits

long >= 32 bits

long >= int >= short >= char

That's about it. I think one could have a perfectly conforming setup where everything was simply 64 bits for instance.

James



Home | Main Index | Thread Index | Old Index