Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 0-1-6 Variables being given values that are never used.
#1
The actual rule is:
Quote:A project shall not contain instances of non-volatile variables being given values that are never subsequently used.
There has been a lot of discussion as to what that sentence actually means. One camp believes that this rule applies to DU dataflow anomalies only, and the other believes that it applies to DU and DD dataflow anomalies.

For example the following code contains a DD dataflow anomaly, but not a DU dataflow anomaly. Is it a Rule 0-1-6 violation?
Code:
int32_t foobar (int32_t const value)
{
    int32_t returnValue = value;
    if (value < 0)
    {
        returnValue = 0;
    }
    return returnValue;
}

This debate is influencing discussions on the merits of variable initialization.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)