This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DATA_ALIGNMENT vs. DECL_USER_ALIGNMENT


On Apr 17, 2003, kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner) wrote:

>     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.

I still don't see why it would make a difference, and why it can
possibly be correct to do anything different.

>     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.

I don't see the difference.  To me, applying the align attribute to a
type has always been equivalent to applying the same attribute to all
declarations of that type, except those that override it with
something different.

>     But why should the common case be more difficult and error-prone?  

> Which is "the common case"?

Have the alignment specified for only one of them, and most likely to
types, which means (to me) that it applies to all declarations of that
type.

> Specifying alignment in Ada is much more common and there the most
> common case is specifying it for types and not for objects.

So we're in agreement on this point.

>     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.

Ok, you got me curious.  Would you mind explaining to an Ada-clueless
person how come these two cases can possibly be different?  In my
C-centric view, I really can't see the difference.  Code snippets
demonstrating the semantic difference would be highly appreciated.

Waiting to be enlightened, :-)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]