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

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

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

java - Cannot secure connection using TLS -