Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One-definition rule violation #11

Closed
GoogleCodeExporter opened this issue Jan 28, 2016 · 1 comment
Closed

One-definition rule violation #11

GoogleCodeExporter opened this issue Jan 28, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Compile after R51
2. Note that there are many definitions of mutex now.

What is the expected output? What do you see instead?

glog should not violate the ODR (one definition rule).

What version of the product are you using? On what operating system?

Any after r51

Please provide any additional information below.

r51 puts Mutex into an anonymous namespace. It is generally a bad idea to
put anything in headers into anonymous namespaces, because then each
includer gets a unique definition of whatever was in the anonymous
namespace in the includee. Because of C++ mangling, the linker will see
many different copies, each with a different name, that it will not
coalesce (or at least, we should not rely on them being coalesced).

I suggest changing Mutex to be inside namespace glog or namespace
glog_internal.

Original issue reported on code.google.com by mie...@gmail.com on 8 Jul 2009 at 4:49

@GoogleCodeExporter
Copy link
Author

r60 should have fixed this. Thanks for the comments!

http://code.google.com/p/google-glog/source/detail?r=60

Original comment by shinichi...@gmail.com on 27 Jul 2009 at 5:46

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant