Bugzilla – Full Text Bug Listing |
Summary: | NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace? | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Tom Henderson <tomh> |
Component: | core | Assignee: | Mathieu Lacage <mathieu.lacage> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | ns-bugs, pdbarnes, tommaso.pecorella |
Priority: | P5 | ||
Version: | ns-3-dev | ||
Hardware: | Mac Intel | ||
OS: | Mac OS |
Description
Tom Henderson
2012-12-12 00:04:23 EST
(In reply to comment #0) > Peter discovered that we have quite a few instances of > NS_LOG_COMPONENT_DEFINE() within namespace ns3, instead of outside. > > Should this be aligned across the codebase? Does it matter? What was the > original motivation for keeping it outside the ns3 namespace? It does not matter. The code of the macro was carefully written to allow one usage or the other. I do not mind enforcing this across the codebase but I am tired of the automatic style police. Can we make it a policy that whenever we want to enforce a style across the codebase, we enforce it whenever we touch the relevant file for other reasons ? It will help avoid mindless search and replace games that can be harmful if you do not understand the code you are modifying. Commit: 597a9ec89e60 http://code.nsnam.org/ns-3-dev/rev/597a9ec89e60 moving the macro outside ns3 namespace raises a MacOS error... [1463/2253] cxx: src/config-store/model/gtk-config-store.cc -> build/src/config-store/model/gtk-config-store.cc.1.o ../src/config-store/model/gtk-config-store.cc:27:1: error: redefinition of 'g_log' as different kind of symbol NS_LOG_COMPONENT_DEFINE ("GtkconfigStore"); ^ ./ns3/log.h:171:28: note: expanded from macro 'NS_LOG_COMPONENT_DEFINE' static ns3::LogComponent g_log = ns3::LogComponent (name) ^ /opt/local/include/glib-2.0/glib/gmessages.h:101:17: note: previous definition is here void g_log (const gchar *log_domain, ^ 1 error generated. I'd say that it's safer to move all of them inside the namespace, rather than outside. Lovely... Actually, stylistically I prefer it inside namespace ns3, but that's not what the docs say. Alright, I'll update the docs and put them all inside. Fixed the other way (NS_LOG_COMPONENT_DEFINE inside namespace ns3) Updated docs. Commit: 2d29fee2b7b8 http://code.nsnam.org/ns-3-dev/rev/2d29fee2b7b8 |