Bug 263 - XxxAddress::ConvertFrom are prone to subtle bugs
: XxxAddress::ConvertFrom are prone to subtle bugs
Status: RESOLVED WONTFIX
: ns-3
node module
: pre-release
: All All
: P1 minor
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2008-07-28 14:32 EDT by
Modified: 2008-12-06 03:11 EDT (History)


Attachments
proof of concept patch (1.66 KB, patch)
2008-07-28 14:33 EDT, Gustavo J. A. M. Carneiro
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-07-28 14:32:07 EDT
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);
}
------- Comment #1 From 2008-07-28 14:33:40 EDT -------
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.
------- Comment #2 From 2008-08-26 00:30:55 EDT -------
(In reply to comment #1)
> Created an attachment (id=213) [details] [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
------- Comment #3 From 2008-10-20 07:47:18 EDT -------
-1