C++ Logo

SG10

Advanced search

Subject: [SG10] Over-aligned dynamic allocation
From: Nelson, Clark (clark.nelson_at_[hidden])
Date: 2016-06-21 13:37:20


In CWG today there was a bit of discussion suggesting that the
changes in P0035 should have a feature-test macro. I have been
thinking about that, and now I'm not so sure.

In practical terms, this is more of a bug fix than a new feature.
Programs that dynamically allocate objects that really need
extended alignment have had to work around the bug.

It seems to me the most plausible use of a feature-test macro
would be along these lines:

class alignas(64) X
{
        ...
#if !__cpp_aligned_new
        // new/delete operators
#endif
};

Would that be considered useful enough to justify a feature-test
macro, in addition to the other new predefined macro?

If so, would __cpp_aligned_new be a reasonable macro name?

Clark


SG10 list run by herb.sutter at gmail.com