Bugzilla – Bug 263
XxxAddress::ConvertFrom are prone to subtle bugs
Last modified: 2008-12-06 03:11:59 EST
Example: void foo (Address dst) { Mac48Address dst48; dst48.ConvertFrom (dst); } This code compiles, but in the end dst48 is just uninitialized. The correct code would be: void foo (Address dst) { Mac48Address dst48 = Mac48Address::ConvertFrom (dst); } Mathieu's idea to avoid the problem is to turn the static method into a function. Code would look like this: void foo (Address dst) { Mac48Address dst48 = Mac48AddressConvertFrom (dst); }
Created attachment 213 [details] proof of concept patch Something along these lines. If accepted, I would do the same thing for all the other ConvertFrom methods and adapt existing ns-3-dev code to use the new API instead of the deprecated one.
(In reply to comment #1) > Created an attachment (id=213) [details] > proof of concept patch > > Something along these lines. If accepted, I would do the same thing for all > the other ConvertFrom methods and adapt existing ns-3-dev code to use the new > API instead of the deprecated one. > +1
-1