C++ Logo

SG10

Advanced search

Subject: Re: [SG10] Comments from Alisdair
From: Nelson, Clark (clark.nelson_at_[hidden])
Date: 2014-05-29 10:38:24


> Thanks for working on this.

And thanks for your comments.

> I have followed this paper for a while, and I notice that while it
> recommends a __has_include() function-like macro, and a
> __has_cpp_attribute() function-like macro, it does not recommend a
> __has_feature() function-like macro, as is used in Clang. As an
> implementation is using it, it might make sense to add why it is
> not
> recommended. I assume it was discussed long ago, but the reasoning
> not
> recorded in the paper.

Technically, at the moment we are exploring __has_cpp_attribute as a direction. It hasn't yet been approved by WG21.

The rationale for not recommending __has_feature is hinted at in the document:

[3] Fortunately Clang has ways to test specifically for the presence of specific features. But unfortunately, the function-call-like syntax used for such tests won't work with a standard preprocessor, so this fine new feature winds up adding its own flavor of complexity to the mix.

To put it more bluntly, SG10's purpose is to make it possible for a program to detect what new features are present in an implementation. If we had made a recommendation that depended entirely on the existence of yet another new feature, we would have built a castle in the air.

Clark


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