Subject: Re: [PATCH 1/9] Define a structure for object IDs.

From: Johannes Sixt <[email-masked]>
Date: Sun, 04 May 2014 22:18:38 +0200

Am 04.05.2014 12:55, schrieb Andreas Schwab:
> Johannes Sixt <[email-masked]> writes:
> 
>> I think that a compiler that has different size and alignment requirements
>> for the proposed struct object_id and an unsigned char[20] would, strictly
>> speaking, not be a "C" compiler.
> 
> Unlike arrays, a struct can have arbitrary internal padding.  It is
> perfectly compliant (and even reasonable) to make struct object_id
> require 8 byte alignment, adding 4 bytes of padding at the end.

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 former would not be the case because there is only one member, and
the latter is not the case because a char or array of char does not have
alignment requirement?

-- Hannes