From: David Kastrup Date: Mon, 05 May 2014 05:19:35 GMT Subject: Re: [PATCH 1/9] Define a structure for object IDs. Message-ID: <87lhugu7iw.fsf@fencepost.gnu.org> In-Reply-To: <87ppjt6xjv.fsf@igel.home> Andreas Schwab writes: > Johannes Sixt 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