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: aligned attribute and the new operator (pr/15795)


trevor_smigiel@playstation.sony.com writes:

>   - the default versions of operator new and the aligned version of
>     operator new should be defined in the same section.  That way,
>     when a user overrides the default operator new, they will get
>     a link error (duplicate definitions of new) unless they also
>     define the aligned version of operator new.

That would be a bad idea since it would break standard conformant
programs which only override the default operator new.

You are implicitly assuming that we know the alignment of memory
returned by new.  If we know that, then whenever we need aligned
memory, we can ask for a bit more memory and force the alignment.
That will always work and avoids the concerns of overriding new.  We
can generate more optimal code by providing a command line option
which specifies the alignment of memory returned by new.

Ian


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