Today, while seeing preprocessed code of <iostream> (g++ 4.4.1), I saw a line which is quite unusual for me syntactically.
namespace std __attribute__ ((__visibility__ ("default"))) {
// ...
}
I have questions for that particular line:
- What’s
__attribute__and what it’s
doing afterstd? (new syntax !) - How the double braces are coming
((in place and is it a new syntax ?
... )) - What’s
__visibility__and what is
it setting as"default"?
__attribute__is a gcc-specific language extension. It lets you alter the declaration of a function, namespace, or other entity in ways that aren’t directly supported by the standard C++ language.C++0x adds language support for attributes, though the syntax is different and most attributes are still implementation-specific.