C++ Logo


Advanced search

Subject: Re: [SG10] A view from CMake
From: Nelson, Clark (clark.nelson_at_[hidden])
Date: 2014-06-02 18:23:32

> Regarding the note here:
> https://isocpp.org/files/papers/n4030.htm#detail.cpp14.n3323
> Clang fails to compile code relying on the described contextual
> conversions unless invoked with -std=c++1y.
> CMake has an explicit feature listing for that to allow the 'fail
> early'
> use-case where that feature is relied upon. Other features not
> listed in
> SD6 may be used explicitly in the CMake functionality for the same
> reason.

It wasn't until I read this that I realized that CMake is actually trying
to solve a very different problem than SG10 is trying to solve.

CMake wants to quickly predict when a build is going to fail eventually, due
to the lack of support for a new feature.

What SG10 is trying to do is enable people to write code that will work
either with or without a new feature. And it says so in SD-6:

[3] Programmers who wish to determine whether a feature is available in an
implementation should base that determination on the state of the macro with
the recommended name. (The absence of a tested feature may result in a
program with decreased functionality, or the relevant functionality may be
provided in a different way. A program that strictly depends on support for
a feature can just try to use the feature unconditionally; presumably, on an
implementation lacking necessary support, translation will fail.)

The goal of CMake in this regard is a good one, but because it's not the
same as that of SG10, there can very reasonably be cases in which different
conclusions will be correct about whether a test for a specific change is
justified. Contextual conversions may well be such a case.


SG10 list run by sg10-owner@lists.isocpp.org