This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: aoliva at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Thu, 17 Apr 03 06:54:51 EDT
- Subject: Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT
Well... You can always compare DECL_USER_ALIGN with TYPE_USER_ALIGN,
if you care strongly about that.
No, you can't. You can't distinguish between the cases where the alignment
is specified for the type and not the object and the case where it is
specified for both.
But the point that whether the alignment came from a decl-specific
attribute or from the type shouldn't make a difference.
Why not? They are two *very* different things with different semantics.
But why should the common case be more difficult and error-prone?
Which is "the common case"? Specifying the alignment of either in C is
very rare since it is a GNU extension. Specifying alignment in Ada is
much more common and there the most common case is specifying it for
types and not for objects.
Do you have any situation in mind in which it is actually important to
tell whether a decl-specific user-requested alignment came from the
variable declaration or from its type?
Sure. It's required to properly implement these specifications for Ada,
where the semantics of the two cases are completely different.