This is the mail archive of the gcc-bugs@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]

[Bug c++/17743] __alignof__ vs. typedefs


------- Additional Comments From gdr at cs dot tamu dot edu  2004-09-30 11:12 -------
Subject: Re:  __alignof__ vs. typedefs

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Actually this is the attribute aligned vs arrays.
| 
| I cannot decode what the documenation means:
| Note that although you can ask the compiler to select a
| time-efficient alignment for a given type and  
| then declare only individual stand-alone objects of that type, the
| compiler's ability to select a time- 
| efficient alignment is primarily useful only when you plan to create
| arrays of variables having the  
| relevant (efficiently aligned) type. If you declare or use arrays of
| variables of an efficiently-aligned type,  
| then it is likely that your program will also be doing pointer
| arithmetic (or subscripting, which amounts  
| to the same thing) on pointers to the relevant type, and the code
| that the compiler generates for these  
| pointer arithmetic operations will often be more efficient for
| efficiently-aligned types than for other types.

I don't see how much this is relevant to the different uses of the
aligned attribute in the library.  Right now, the compiler is just
ignoring the aligned attribute.  We're more intersted in the semantics
than in the speed.

What we want is to align a given *array object* at some alignment
boundaries.  We're not interested in pointer arithmetics on array
types or speed -- although we may be doing pointer arithmetic on
individual elements of the array, but that is a separate issue.
The primarily thing is the ability to align an array object on a given
boundary. 

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17743


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