C++ Logo


Advanced search

[SG10] Over-aligned dynamic allocation

From: Nelson, Clark <clark.nelson_at_[hidden]>
Date: Tue, 21 Jun 2016 18:37:20 +0000
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

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?


Received on 2016-06-21 20:45:22