Any thing present in the anonymous namespace can be accessed in the same file only forcing
internal linkage and eliminating the overuse of static.
A word of caution overuse of anything is bad and the same applies to anonymous namespace also
For example consider a file
//file.cpp
namespace anonymous
{
int x;
};
int main()
{
std::cout<<"X present in this file has the value"<
}
although this x is present in the global area still has the file scope only without using the static
keyword.

No comments:
Post a Comment