C++ Logo

sg10

Advanced search

Re: [SG10] Generalized/relaxed const. expr.

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Tue, 04 Jun 2013 22:30:28 +0200
On 06/04/2013 05:33 PM, Nelson, Clark wrote:
> I note that no one has (yet) specifically argued that the difference
> between C++11 and C++14 in this area is subtle or minor -- that being
> the criterion I would prefer for using a different macro value,
> instead of a different name.

>From an engineering tidiness point-of-view, I do have a preference
to change macro values instead of having more macro name pollution.
Remember we'll have >100 macro names within a decade or so, all
addressing one or the other corner of the language.

#if __cpp_constexpr > 201300
... // stellar constexpr
#elif __cpp_constexpr
... // use ugly recursion to simulate iteration
#else
... // just give up
#endif

seems reasonable, and compares well against

#if __cpp_constexpr_iteration

#elif __cpp_constexpr

#endif


Whatever macro name we choose, it's likely that you need an additional
comment in your source code to explain what the precise sub-feature
is you're depending on, so simply using __cpp_constexpr seems to give
enough of a clue for my taste. (I don't buy the "minor feature"
argument here, but that's just my weak personal opinion.)

Thanks,
Jens

Received on 2013-06-04 22:30:48