namespace syntax

so i found iostream source code in this web:
https://code.woboq.org/gcc/libstdc++-v3/include/std/iostream.html

been curious abt namespace syntax, how could it wrote like this?
namespace std _GLIBCXX_VISIBILITY(default)

i've look for namespace syntax in cpp ref, but didn't found that kind of syntax. anyone can explain?
https://en.cppreference.com/w/cpp/language/namespace
@seeplus: ok, but what's the meaning of syntax namespace test_space something_here { ?
Hello Chipp,

Also have a look at:
https://www.learncpp.com/cpp-tutorial/2-9-naming-collisions-and-an-introduction-to-namespaces/

Also have a look at chapter 6. 6.2 and 6.12.

Andy
@andy: i alrdy go to https://www.learncpp.com/cpp-tutorial/user-defined-namespaces/ but didn't find any syntax like i asked above... can you explain it?
See cppreference.

https://en.cppreference.com/w/cpp/language/namespace
inline(optional) namespace attr(optional) identifier { namespace-body } 	


You can specify attributes in the "something_here" part.

_______________________________

The particular macro you're talking about eventually expands to something with the __visibility__ attribute, which is not part of C++ itself but is an extension in GCC/IBM (and probably other) compilers.
https://www.ibm.com/support/knowledgecenter/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/language_ref/type_attr_visibility.html
With the visibility type attributes, you can control whether and how a structure/union/class or an enumeration that is defined in one module can be referenced or used in other modules. Visibility attributes affect only types with external linkage. By using this feature, you can make a shared library smaller and decrease the possibility of symbol collision.
Last edited on
You can specify attributes in the "something_here" part.

but the syntax is the opposite with my question... attr is before identifier

what i'm asking is the opposite (namespace test_space attr)

but looks like it's related to extended compiler like you said
https://www.learncpp.com/cpp-tutorial/configuring-your-compiler-compiler-extensions/
Last edited on
Oh you're right, it is a different order than the standard attributes.
Topic archived. No new replies allowed.