aligned attribute and the new operator (pr/15795)

Mark Mitchell mark@codesourcery.com
Thu Oct 12 18:06:00 GMT 2006


trevor_smigiel@playstation.sony.com wrote:

> If we are willing to consider an ABI change, I think an approach that
> allows new to call some form of memalign would be better than having the
> compiler force alignment after calling new.  
> 
> Are we open to making an ABI change?

Personally, I think an ABI change, at the compiler level should be off 
the table.  (I say "Personally" to make clear that this is just my 
opinion as a C++ maintainer and as a co-developer of the C++ ABI 
specification, but not an SC decision.  And, for those who may find 
these parentheticals tedious, they're there because some people have 
previously interpreted statements from me as dictates; I'm trying to be 
very careful to make sure it's clear what hat I'm wearing.)

The C++ ABI has actually been stable for years now, which is a huge 
achievement.  We've gotten binary interoperability to work for most 
programs between a lot of C++ compilers, which is a good thing for all. 
  In my opinion, the next change to the C++ ABI should come if (and only 
if) C++0x requires changes.  Even there, I would hope for 
backwards-compatible changes -- for example, mangling for variadic 
templates would ideally be an extension to the current mangling scheme. 
  In other words, we should strive to make it possible to link current 
C++ libraries with C++0x programs, which means that the sort of change 
you're considering would be off the table.

Adding a compiler command-line option to specify the alignment of memory 
returned by "operator new", or a GNU attribute that libstdc++ could add 
to the default declaration (with a system-dependent value, of course), 
etc. seems fine to me, but I'd be very hesitant to change the ABI proper.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc mailing list