
Joaquín Mª López Muñoz <joaquin@tid.es> writes:
libs/thread/src/mutex.inl: *U* unnamed namespace at line 7 libs/thread/src/timeconv.inl: *U* unnamed namespace at line 7 libs/thread/test/util.inl: *U* unnamed namespace at line 19
I foolowed the link http://www.boost.org/tools/inspect/index.html and then "guidline violations" http://www.boost.org/more/lib_guide.htm but was not able to find the guidelines about "usage of unnamed namespaces in headers". Also the suspect files are neither *.hpp nor *.ipp.
Another guideline that we don't check for, and maybe we never wrote down: all files containing C++ source code should have a 3-letter extension ending in "pp". This decision dates back to the earliest days of Boost, when Nico Josuttis was still a heavy player here (it was his idea, and a good one -- it makes searching through C++ source files much easier). So please, no ".inl" files. If you really must use a separate file for inline implementation, use ".ipp"
As for the latter, the problem with unnamed spaces in headers is that they can lead to ODR violations, see for instance:
http://lists.boost.org/Archives/boost/2004/06/67159.php
Can you please give me a hint, how I should correct this?
If you think your usage of unnamed spaces is actually correct, then simply have your file contain the following (possibly inside a comment):
boostinspect:nounnamed
to instruct the inspect tool to skip.
Yeah, but be really careful, because there are only a few good ways to use an unnamed namespace in a header. In fact, the only legitimate way to fix the Boost.Bind placeholder issue for header-only libs, without ODR or order-of-initialization issues, is: // placeholders.hpp template <class SomePOD> static pod_singleton { const SomePOD instance; }; template <class SomePOD> SomePOD const pod_singleton::instance = { /*optional contents*/ }; namespace { some_pod const& _1 = pod_singleton<some_pod>::instance; } That's an unnamed namespace in a header. -- Dave Abrahams Boost Consulting www.boost-consulting.com