Here is an example of two namespaces in two different files:
There is a namespace definition in file1.cpp where the main function is located like this. This namespace is defined outside of main(), so it is global.
namespace {
char const * const GID{ "SOMENAME" };
int summary( void );
}
Then in file2.cpp, the same GID is defined as:
namespace {
char const * const GID{ "SOMEOTHER_NAME" };
}
I think the GID constant char only sits in corresponding file. For example, SOMEOTHER_NAME is only used in file2.cpp. But if that's the purpose, isn't it better just use a different name than GID?
Also, if I want to use the summary() function in file1.cpp, then how to use the namespace in file1? Note that the namespaces don't have names.