tech-kern archive

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

Re: setsockopt() compat issue



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.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index