[cmake-developers] c++ feature detection and usage requirements
Stephen Kelly
steveire at gmail.com
Mon Sep 2 02:03:21 EDT 2013
Brad King wrote:
> BTW, I think a better name may be "language features" rather than
> "compiler features" because we are declaring features of language
> versions and variants, not of the compilers.
I don't agree with that. We are enumerating/introspecting the features of
the compiler. The fact that the compiler is following a standard for its
features is/should be irrelevant to the interface, and to the list of
features.
I've seen a few projects debating the useless question of 'Can we use C++11
now?', which eventually or quickly turns into the useful question of 'What
features can we use from our compiler, given our minimum requirements?'.
That's actually the same question they've always had to ask. They didn't
consider questions like 'can we use C++98 now?', but 'can we use member
templates now?'. The answer often being 'Yes, if we don't support MSVC6
anymore - it does not have that feature'.
Such a view also justifies using the non-language-standard MSVC 'sealed'
keyword in place of 'final' for 'the "final" feature', as the features are
compatible.
There may be other cases of such compatibility from non-standard compiler-
provided features (which influenced the standard presumably).
> It is only in the
> implementation that we need to deal with compiler support for the
> features.
Contrarily I say, it is only in the implementation that we need to consider
the language-standard support for the features, because that is where the
implementation needs to know (for some compilers) the standard the feature
was introduced in, in order to pass the correct -std= argument.
The language standard does not appear in the interface I've proposed,
because it is irrelevant. The only relevant information is the minimum
compiler requirements of the project.
Thanks,
Steve.
More information about the cmake-developers
mailing list