C++ Logo


Advanced search

[SG10] Some small precedence for feature testing in C++

From: Smith-Rowland, Edward M <ESmith-rowland_at_[hidden]>
Date: Wed, 31 Jul 2013 19:42:45 +0000

It seems we are still casting about for an approach or an aesthetic for the feature test macros.

It occurred to me that this has been broached before in C++: TR 29124 - Information Technology - Programming Languages C++ - Special math functions (based on ISO/IEC 14882) (http://www.open-std.org/JTC1/sc22/WG21/docs/papers/2010/n3060.pdf).

In short, they use:
  The following macro name shall be conditionally deļ¬ned by the implementation:
  __STDCPP_MATH_SPEC_FUNCS__ The value 201003L, intended to indicate conformance to this International Standard.

Proposals to add new special math functions shall have the date value increased appropriately. They also deemed it important to have the date be a long - perhaps to accommodate platforms with 16-bit integers. Perhaps we should follow suite.

They also have a macro to turn off extra math functions (or maybe opt in) but we aren't doing that. ;-)

I don't know if this has been discussed before. I don't know if we care about stylistic compatibility. I kind of like compatibility personally. We could however *add* an alias __cpp_lib_special_functions equal to __STDCPP_MATH_SPEC_FUNCS__. Our macro would not be defined if the feature control macro, __STDCPP_WANT_MATH_SPEC_FUNCS__, was set to 0 (or if the math special functions are otherwise unavailable).

(FYI: The special function TR number is wrong on the ISO website)

Ed Smith-Rowland

Received on 2013-07-31 21:58:18