C++ Logo


Advanced search

[SG10] freestanding interactions with feature test macros

From: Ben Craig <ben.craig_at_[hidden]>
Date: Thu, 22 Aug 2019 15:38:16 +0000
In the CD, freestanding pulls in the <version> header. The version header is required to define feature test macros like __cpp_lib_filesystem, even though filesystem is not required to be part of freestanding. It seems misleading to require the macro to be defined in <version> in this case.

I've started down this library rabbit hole in https://wg21.link/p1641R0. That paper is targeting C++23 and will need some updates for Belfast.

Going further on the library side, sometimes we have feature test macros where some of the feature is freestanding, and some isn't. It would be nice if we could agree on a policy and a code pattern for how this should be handled. A potential example is __cpp_lib_chrono. For C++20, none of chrono will be freestanding, but some of my papers have suggested making parts of chrono freestanding (like the duration math).

Now to get way ahead of myself and start talking about the core language. Suppose we made floating point not required for freestanding. How would we handle feature test macros for that? I have a strawman suggestion in https://wg21.link/p1105r1 to define the macro __cpp_freestanding_no_floating_point_support, but I haven't yet tried to use this macro in a meaningful way.

What is the best venue to discuss these feature test macro design decisions? Should we have a telecon at some point in the future? An in-person half-day at Belfast? Or should I just post a paper for review on this list and attempt to determine consensus from the mailing list only?

Received on 2019-08-22 19:12:57