In such a situation
namespace n {
void f() {
void another_function();
}
}
Should the function another_function
be defined inside the namespace n
or outside? VS 2012 (with the November CTP) says it should be outside, and GCC 4.7.2 on the Mac says it should be inside. If I do the wrong one, I get undefined symbol errors from the linkers.
I generally trust GCC to be more compliant to the standard, but this is C++ and you can never be sure.
another_function
is an implementation detail andf
is a template. – Confessionanother_function
insidef
doesn't make it less visible thanf
. It will just cause multiple definition errors if someone happens to define their ownn::another_function
. – Ideomotoryour_namespace::detail
. That's what boost does in these situations anyway. The convention is that anything inside a namespacedetail
are implementation details. – Ideomotor