Bugzilla – Full Text Bug Listing |
Summary: | NS_LOG_UNCOND and NS_LOG macros | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Carlo Bellettini <cbellettini> |
Component: | core | Assignee: | Carlo Bellettini <cbellettini> |
Status: | RESOLVED INVALID | ||
Severity: | minor | CC: | mathieu.lacage |
Priority: | P5 | Keywords: | patch |
Version: | ns-3-dev | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | Macros arguments now bracketed in expansion |
1) don't mark bugs as "fixed" unless they are "fixed" in ns-3-dev. 2) I tried your patch and it fails to build: [272/702] cxx: src/core/object-base.cc -> build/debug/src/core/object-base_1.o ../src/core/object-base.cc: In member function ‘void ns3::ObjectBase::ConstructSelf(const ns3::AttributeList&)’: ../src/core/object-base.cc:63: error: no match for ‘operator<<’ in ‘"construct tid=" << ns3::TypeId::GetName() const()’ ../src/core/type-id.h:372: note: candidates are: std::ostream& ns3::operator<<(std::ostream&, ns3::TypeId) ../src/core/object-base.cc:69: error: no match for ‘operator<<’ in ‘"try to construct \"" << ns3::TypeId::GetName() const()’ ../src/core/type-id.h:372: note: candidates are: std::ostream& ns3::operator<<(std::ostream&, ns3::TypeId) ../src/core/object-base.cc:85: error: no match for ‘operator<<’ in ‘"construct \"" << ns3::TypeId::GetName() const()’ ../src/core/type-id.h:372: note: candidates are: std::ostream& ns3::operator<<(std::ostream&, ns3::TypeId) ../src/core/object-base.cc:103: error: no match for ‘operator<<’ in ‘"construct \"" << ns3::TypeId::GetName() const()’ ../src/core/type-id.h:372: note: candidates are: std::ostream& ns3::operator<<(std::ostream&, ns3::TypeId) ../src/core/object-base.cc:134: error: no match for ‘operator<<’ in ‘"construct \"" << ns3::TypeId::GetName() const()’ ../src/core/type-id.h:372: note: candidates are: std::ostream& ns3::operator<<(std::ostream&, ns3::TypeId) ../src/core/object-base.cc:150: error: no match for ‘operator<<’ in ‘"construct \"" << ns3::TypeId::GetName() const()’ ../src/core/type-id.h:372: note: candidates are: std::ostream& ns3::operator<<(std::ostream&, ns3::TypeId) Waf: Leaving directory `/home/mlacage/code/ns-3-dev/build' Build failed -> task failed (err #1): {task: cxx object-base.cc -> object-base_1.o} I have to confess that I don't see how what you are proposing could possibly work. I would tend to mark this bug INVALID unless you come up with a new version of your patch which works. actually, that patch does solve that very particular issue, but also leads to invalidate handy expressions involving << like in NS_LOG_UNCOND("i = " << 3), since ("i = 3" << 3) is hardly convertible to an ostream... an extra pair of brackets in very special circumstances is probably a more than acceptable workaround, but other suggestions are welcome. so you are ok if I mark this as INVALID ? (In reply to comment #3) > so you are ok if I mark this as INVALID ? > with no other suggestions, I think it'd be appropriate. |
Created attachment 533 [details] Macros arguments now bracketed in expansion I noticed this in ns-3.5. In core/log.h +307, it'd be useful to rewrite the NS_LOG_UNCOND macro as: std::clog << (msg) << std::endl; so that lower precedence operators like in NS_LOG_UNCOND(cond ? a : b) won't require extra bracketing. the same holds for NS_LOG. patch for ns-3.5 (release) attached