C++ Logo

SG10

Advanced search

Subject: Re: P1847 Make declaration order layout mandated
From: Barry Revzin (barry.revzin_at_[hidden])
Date: 2020-11-01 09:25:33


Hi SG10,

On Thu, Oct 29, 2020 at 7:05 AM Balog Pal via SG10 <sg10_at_[hidden]>
wrote:

> I asked guidance after the last meeting. I did not get a reply back then
> and concluded it as confirming the idea to NOT have the macro.
> If someone thinks it is needed after all, please say so.
>
> http://open-std.org/JTC1/SC22/WG21/docs/papers/2020/p1847r3.pdf

I'd like to see some response to this question. It's kind of a novel one,
as far as I can tell.

Usually, we don't add feature-test macros where the motivation is to
*mandate* the existence of the feature. As was described here:

[Balog]:

> > I have one use case in mind. In my projects I usually have a
> > configuration/environments checking headers, that looks for compiler,
> > language version and platform attributes, with #error if anything is
> > not as expected. Especially for things that were assumed and built on.
> >
> > The paper imposes a strict and reliable order of members, that is not
> > unreasonable to assume. And that is easier to check with a related
> > than a more generic one.
> >
> > OTOH my argument in the was that no one is actually swapping.
> >
> > I'm not in live with the macro and happy to remove it, please make a
> > verdict before the postmailing deadline.
>

And we typically don't add such a macro because for nearly all features, if
you simply use the feature, that's mandating its existence, and a compiler
that doesn't implement it will just error already. But in this case,
"using" the feature doesn't change any code -- it just changes the code
gen. On the other hand, as he points out, all the implementations already
seem to implement this feature.

Does anybody have an opinion on whether we should or should not have a
macro for this feature?

Barry



SG10 list run by sg10-owner@lists.isocpp.org