[Ns-bugs] [Bug 281] Socket::CreateSocket (node, "string") does not do what you think

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Wed Aug 13 13:38:06 PDT 2008


http://www.nsnam.org/bugzilla/show_bug.cgi?id=281





------- Comment #2 from raj.b at gatech.edu  2008-08-13 16:38 -------
Created an attachment (id=228)
 --> (http://www.nsnam.org/bugzilla/attachment.cgi?id=228&action=view)
Testcase and fix in one

I changed the PacketSink call to Socket::CreateSocket to pass the correct const
char* instead of a TypeId (this is the test case).

The fix is the explicit keyword.  As you will see, the compiler doesn't do the
implicit conversion from const char* using the offending TypeId constructor any
longer, and it won't compile this kind of code instead of subtly failing at
runtime:

../src/applications/packet-sink/packet-sink.cc:88: error: no matching function
for call to 'ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node>, const char*)'
debug/ns3/socket.h:94: note: candidates are: static ns3::Ptr<ns3::Socket>
ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node>, ns3::TypeId)

Mathieu, comments?


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Ns-bugs mailing list