Subject: Re: CMSG_* problems
To: None <tech-userlevel@NetBSD.org, tech-kern@NetBSD.org>
From: Alan Barrett <firstname.lastname@example.org>
Date: 02/13/2007 10:13:24
On Mon, 12 Feb 2007, Jason Thorpe wrote:
> On Feb 12, 2007, at 3:27 PM, der Mouse wrote:
> >Will be able to contain a pointer, sure. But not necessarily, will be
> >at least as strictly aligned as a pointer.
> You're completely wrong on this one. intmax_t is by definition at
> least as large and at least as alignment-strict as intptr_t, which in
> turn is by definition at least as large and at least as alignment-
> strict as a pointer.
I think Mouse is right. intmax_t is guaranteed to be at least as large
as any other integer type (C99 committee draft N1124 section 188.8.131.52),
but I don't see any guarantees about the alignment of intmax_t relative
to the alignment of any other integer type. intptr_t is guaranteed
to be convertible to and from any pointer (section 184.108.40.206), but I
see no guarantees about the alignment of intptr_t relative to the
alignment of any pointers, nor even any guarantees about the size of
intptr_t relative to the size of any pointers (for example, as Seebs
mentioned in another message, conversion between a pointer and an
intptr_t could involve removing or inserting some bits that are known to
have a constant value).
--apb (Alan Barrett)