According to the (now defunct) StackOverflow documentation on Extending the std
namespace and [namespace.constraints]:
The behavior of a C++ program is undefined if it adds declarations or definitions to namespace
std
or to a namespace within namespace std unless otherwise specified.
and
The behavior of a C++ program is undefined if it adds declarations or definitions to namespace
posix
or to a namespace within namespaceposix
unless otherwise specified. The namespaceposix
is reserved for use by ISO/IEC 9945 and other POSIX standards.
Do these rules only apply to the global std
and posix
namespaces, or is something the following also undefined:
namespace HelloWorld {
namespace std {
void terminate();
}
}
Perhaps it's because I'm native in English, but the wording of those rules seems to be a bit vague in this aspect.