Bug 994 - PointToPointGridHelper useless if clauses
PointToPointGridHelper useless if clauses
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: helpers
ns-3-dev
All All
: P5 trivial
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-16 00:37 EDT by Quincy Tse
Modified: 2010-09-16 15:52 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (446 bytes, patch)
2010-09-16 00:37 EDT, Quincy Tse
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Quincy Tse 2010-09-16 00:37:15 EDT
Created attachment 976 [details]
Proposed patch

../src/helper/point-to-point-grid-helper.cc:181:11: error: ]
      comparison of unsigned expression < 0 is always false
      [-Wtautological-compare]
  if (row < 0 || col < 0 || 
      ~~~ ^ ~

row and col in GetNode and GetIpv4Address are both uint32_t, thus can never be below 0 - if clause always false.
Comment 1 Josh Pelkey 2010-09-16 15:52:25 EDT
The proposed patch is for a different bug, but I went ahead and just fixed by removing those cases out of those two if statements (line 181 and 193).

BTW, the if clause is not *always* false, as these are logical ORs and there are other cases within that conditional that could evaluate to true.  I went ahead and removed them anyway, since they are simply unnecessary.