Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added more notes

...

Code Block
f(): 0
g(): 42
f(): 100
g(): 42
Page properties
hiddentrue

I suspect that we may want an exception for allowing unnamed namespaces in header files under certain cirumstances. For instance, it may be permissible for constant values in unnamed namespaces (but then again, those could still result in ODR violations). I know that some implementations of bind() (such as Boost's) put the placeholders into an unnamed namespace, but smart folks like Dave Abrahams have said this is likely a mistake and a bug. It's worth doing further research as to what exceptions, if any, would be useful.

Risk Assessment

Defining an unnamed namespace within a header file can cause data integrity violations and performance problems, but is unlikely to go unnoticed with sufficient testing. One Definition Rule violations result in undefined behavior.

...