On Thu, Jan 8, 2009 at 10:15 AM, Ian Lance Taylor <i...@google.com> wrote: > "H.J. Lu" <hjl.to...@gmail.com> writes: > >>> Given that __attribute__ ((aligned (max))) may change, I don't >>> think it is very useful. A portable generic memory allocator should >>> take an additional argument for alignment. >>> >> >> If we really want the maximum useful alignment for the target machine >> we are compiling for, I would prefer __attribute__ ((aligned (best))) >> and document that it may be changed by -mXXX. > > I don't care what the name is. > > It's hard to pass an alignment parameter to the memory allocator when > using the C++ new operator. >
It it hard to guess what the alignment should be for C++ new operator. Whatever you choose today may not be appropriate tomorrow or for others. I think g++ should issue a warning when new operator is used on a type whose alignment greater than MALLOC_ABI_ALIGNMENT: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36159 -- H.J.