Subject: Re: P1847 Make declaration order layout mandated
From: John Spicer (jhs_at_[hidden])
Date: 2020-11-01 10:08:06
Having a feature test macro for this seems to be of limited usability.
If the macro existed, EDG would probably use our configuration parameter (mentioned in the paper) to control the setting of the macro.
But a user of the macro would probably have to assume that the macro not existing (as would be the case for pre-C++23 compilers) means that the order is the one expected by the paper. So if some older compiler did not use the expected layout, the macro wouldn't help.
One of the SG10 guidelines is that feature test macros are generally only needed if the programmer would write the code in two different ways depending on the setting of the macro.
So, it doesn't seem that helpful to me, but I have no objection to adding a macro for this if there is sufficient interest in doing so.
> On Nov 1, 2020, at 10:25 AM, Barry Revzin via SG10 <sg10_at_[hidden]> wrote:
> Hi SG10,
> On Thu, Oct 29, 2020 at 7:05 AM Balog Pal via SG10 <sg10_at_[hidden] <mailto: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 <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:
> > 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?
> SG10 mailing list
SG10 list run by email@example.com