Re: [PATCH 1/9] Define a structure for object IDs.
- From
David Kastrup <dak@gnu.org>
- Date
- May 5, 2014, 05:19 UTC
- Message-ID
- <87lhugu7iw.fsf@fencepost.gnu.org>
- In-Reply-To
- <87ppjt6xjv.fsf@igel.home>
Andreas Schwab <schwab@linux-m68k.org> writes:
Show 8 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes: > >> Isn't internal padding only allowed between members to achieve correct >> alignment of later members, and at the end only sufficient padding so >> that members are aligned correctly when the struct is part of an array? > > The standard allows arbitrary internal padding, it doesn't have to be > minimal.
What the standard does guarantee is that a pointer to a struct can be cast to a pointer to its first member and vice versa. It does not as far as I can see guarantee that a pointer to something of the same type of its first member can be converted to a pointer to a struct even if the struct only contains a member of such type.
-- David Kastrup