Date: Tue, 21 Jun 2016 22:24:32 -0400
> On Jun 21, 2016, at 2:37 PM, Nelson, Clark <clark.nelson_at_[hidden]> wrote:
>
> 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?
>
I think it would be useful.
I would prefer using something like __cpp_aligned_new over use of the new __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro that is part of the proposal because:
1. I think the feature test macro is clearer and more consistent with how we test other features.
2. It gives us the ability to adjust the macro value if there are revisions to the feature.
I can imagine that the macro would also be used by people who replace the global operator new, and who would also replace the aligned version if it were present.
John.
>
> 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?
>
I think it would be useful.
I would prefer using something like __cpp_aligned_new over use of the new __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro that is part of the proposal because:
1. I think the feature test macro is clearer and more consistent with how we test other features.
2. It gives us the ability to adjust the macro value if there are revisions to the feature.
I can imagine that the macro would also be used by people who replace the global operator new, and who would also replace the aligned version if it were present.
John.
Received on 2016-06-22 04:24:35