Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are unknown attributes supposed to be treated before C++17?

cppreference says that

All attributes unknown to an implementation are ignored without causing an error.

... but that this edict was introduced in C++17. What about earlier versions of C++? Are unknown attributes supposed to be errors? Is it implementation-defined what to do with them?

like image 799
einpoklum Avatar asked Sep 10 '25 22:09

einpoklum


1 Answers

It was implementation-defined since its introduction in C++11.

See [dcl.attr.grammar]/5:

For an attribute-token not specified in this International Standard, the behavior is implementation-defined.

like image 184
rustyx Avatar answered Sep 13 '25 11:09

rustyx