C++ Logo

sg10

Advanced search

[SG10] How closely should our recommendation match clang?

From: Nelson, Clark <clark.nelson_at_[hidden]>
Date: Fri, 25 Jan 2013 00:40:36 +0000
We can't ignore clang, as it is the only popular implementation that has done anything systematic about language feature-testing. But what clang has already done about C++11 (i.e. the past) isn't directly applicable to the future; it's only a model. On the other hand, it's very instructive, especially as regards granularity.

To me, the most obvious question is whether testing for the presence of a feature should use a function-like syntax, or just an identifier. From a programming perspective, there's no practical difference between these two alternatives:

__has_feature(cxx_alignas)
__has_feature_cxx_alignas

On the other hand, if the function-like syntax is used to test for a feature, somehow there has to be a definition of the function-like macro, or simply testing for the feature is likely to be an error. That would either limit the usefulness of feature-testing, or require users to add boilerplate to conditionally define the function-like macro.

--
Clark Nelson            Vice chair, PL22.16 (ANSI C++ standard committee)
Intel Corporation       Chair, SG10 (WG21 study group for feature-testing)
clark.nelson_at_[hidden]

Received on 2013-01-25 01:40:53