Where can I find C ++ attribute information [[deprecated]]

I sent a link describing the [[deprecated]] attribute in C ++ 11. This sound is quite convenient, and I would like more information about this - which compilers support it, full documentation on it, etc.

I spent about 20 minutes searching, but apart from the linked website, I could not find information about it anywhere. This was partly complicated by other uses of the word "outdated" in connection with C ++ 11, and search engines did not recognize [[ . I did not find this in draft standards related to various SO answers. I do not have access to full, paid, standard.

Does anyone have more information about this attribute [[deprecated]] ?

PS: If you are interested, I would use this as the best alternative to https://stackoverflow.com/a/3186/

+6
source share
2 answers

The [[deprecated]] attribute contributed to the C ++ 14 project (see section 7.6.5 [dcl.attr.deprecated] of the October draft ).

The deprecated token attribute can be used to indicate names and objects whose use is still permitted, but for some reason is not recommended.

For example, the following foo function is deprecated:

 [[deprecated]] void foo(int); 

You can provide a message that describes why the name or object is deprecated:

 [[deprecated("Replaced by bar, which has an improved interface")]] void foo(int); 

The message must be a string literal.

+13
source

First, things in [[]] are not keywords; they are attributes.

Secondly, there is no [[deprecated]] attribute defined by the C ++ 11 standard. The link you are referencing is either an error or it refers to a specific compiler (possibly C ++ Builder?) That implements this attribute.

Attributes are (usually) specific to the compiler. Like #pragma s, compilers should ignore any attribute that they do not support.

+7
source

Source: https://habr.com/ru/post/917983/


All Articles