C++ Logo

sg10

Advanced search

Re: [SG10] __has_cpp_attribute example

From: Nelson, Clark <clark.nelson_at_[hidden]>
Date: Wed, 12 Oct 2016 17:51:43 +0000
> This leaves ATTR_DEPRECATED undefined if the compiler doesn't
> support
> the __has_cpp_attribute macro, is that intended? Unless the idea is
> that some other method would be used to decide if it's available, it
> should be something like:
>
> #ifdef __has_cpp_attribute
> # if __has_cpp_attribute(deprecated)
> # define ATTR_DEPRECATED(msg) [[deprecated(msg)]]
> # endif
> #endif
> #ifndef ATTR_DEPRECATED(msg)
> # define ATTR_DEPRECATED(msg)
> #endif

Thanks for the suggestion. I have updated the example in SD-6 (with a
slight fix, left as an exercise for the reader).

> Would it also be useful to mention that the grammar term
> "attribute-token" allows scoped attributes, such as foo::bar, so
> that
> non-standard attributes can be tested the same way?

We already talk about vendor-specific attributes in 3.3.2p2, so ISTM
that's kind of explicit already. Did you have a specific change in
mind?

Clark

Received on 2016-10-12 20:02:37