It is legal. You can use Foo anywhere in the same Translation Department .
Anonymous namespace is the standard prescribed way of expressing static for variables to limit the scope to the same translation unit.
C ++ 03 Standard Section 7.3.1.1 Namespaces
para 2:
Using a static keyword is deprecated when declaring objects in a namespace scope; an unnamed namespace provides an excellent alternative.
Update:
As @Matthieu M. correctly points out in the comments, and his answer . The C ++ 11 standard removed the above quote from the C ++ 03 Standard, which implies that the static not expired when declaring objects in the namespace scope, the Anonymous or Bezymyanny namespace is still valid.
source share