c++ - Using gcc attributes with C++11 attributes syntax -


i trying use gcc attributes c++11 syntax. example this:

static void [[used]] foo(void) {     // ... } 

but following:

warning: ‘used’ attribute ignored [-wattributes] static void [[used]] foo(void)             ^ 

why attribute ignored? possible use gcc attributes c++ attributes?

[[gnu::used]] static void foo(void) {} 

first, attribute can appear in specific places, otherwise get:

x.cc:1:13: warning: attribute ignored [-wattributes]  static void [[gnu::used]] foo(void) {}              ^ x.cc:1:13: note: attribute appertains type-specifier ignored 

second, used not standard warning, gets hidden in proprietary namespace gnu::.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -