The great inapplicable attribute debate
Stewart Gordon
smjg_1998 at yahoo.com
Tue Apr 14 05:55:04 PDT 2009
Don wrote:
> Stewart Gordon wrote:
<snip>
>> Surely, align isn't applicable to unions at all. IINM the members of
>> a union, by design, start at the same offset.
>
> Not so, the alignment of each member should be respected.
But the offset of a union member is always zero. So what would this do?
> Most obviously, a union U consisting of a single member x should have
> U.alignof == x.alignof.
<snip>
Yes, by propagating the union's alignment (relative to the containing
struct) to the member.
Stewart.
More information about the Digitalmars-d
mailing list