[Development] RFC: handling of C++ feature test macros

Thiago Macieira thiago.macieira at intel.com
Mon Sep 9 17:26:27 CEST 2019


On Monday, 9 September 2019 05:44:15 PDT Mutz, Marc via Development wrote:
> 1. For the writer of the code, having to add the version check means
> researching the history of a feature to unearth the value with which the
> feature was originally added. cppreference.com is not very helpful in
> that regard, as APIs are tagged with (since C++17), but not with (if
> __cpp_foo >= 201911). There's a page listing all the values, incl., one
> might hope, all the historical ones, but it's still extra work.
> 
> 2. For the reader of the code, at least those poor souls who cannot
> memorize all the feature macros' initial values, the version check
> actively hides information: the structure of the code indicates that the
> code depends on a certain version of the feature when in fact it
> doesn't.
> 
> 3. The wider C++ community seems to settle for non-versioned checks if
> the initial version is sufficient, which may mean that Qt introduces an
> impedance mismatch for pre-standard values where Qt checks the version
> and users and other libraries do not. If there actually are non-standard
> implementation who nonetheless defined the standard feature-test macro,
> but with a lower value, Qt and the user will not agree on the presence
> of a feature.

Ok.

I have no objection. I prefer the versioned one, but you have good arguments 
why it would be difficult to the developer.

I always found that reading SD-1 was easy, but now that it's been incorporated 
into the language it may no longer be.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products






More information about the Development mailing list