I have a free function, foo
, defined in a namespace N. The header for foo
is in the global include search path so anyone can call it by including foo.h
.
foo
calls another local, free function, foo1
, which is defined in foo.cpp
.
// foo.h
namespace N
{
void foo();
}
// foo.cpp
#include "foo.h"
namespace
{
// declare in the unnamed namespace?
void foo1()
{
// do some stuff
}
}
namespace N
{
// declare in namespace N?
void foo1()
{
// do some stuff
}
void foo()
{
foo1();
}
} // N
Should I put foo1
in the unnamed namespace or in namespace N
? Or doesn't it matter?
UPDATE
I want to limit the scope of foo1
to foo.cpp
.