Click on image to see enlargment

PC-lint/FlexeLint Output | Reference Manual Explanation | Home

            bug550.cpp

1    class Reindeer
2        {  public:
3        char *name;
4        bool injured;
5        bool in_flight;
6        bool needs_rest;
7        };
8    const int NumRD = 250;
9    extern Reindeer all[ NumRD ];
10   int reindeer_available()
11       {
12       int count = NumRD;
13       int n = 0;
14       for( int i = 0; i < count; i++ )
15           {
16           if( !all[i].injured &&
17               !all[i].in_flight &&
18               !all[i].needs_rest ) n++;
19           }
20       return count;
21       }

With so many deliveries on Christmas eve, Santa is finally automating his Reindeer Tabulating System but this reindeer availability function is way too optimistic. What's going wrong?


bug550.cpp lint Output

--- Module:   bug550.cpp (C++)
    _
    }
bug550.cpp  21  Warning 550: Symbol 'n' (line 13) not accessed

    --- Wrap-up for Module: bug550.cpp

Info 754: local structure member 'Reindeer::name' (line 3, file bug550.cpp) not
    referenced

Reference Manual Explanation


550    Symbol 'Symbol' (Location) not accessed  -- A variable (local to some function) was not accessed.
       This means that the value of a variable was never used.  Perhaps the variable was assigned a value
       but was never used.  Note that a variable's value is not considered accessed by autoincrementing
       or autodecrementing unless the autoincrement/decrement appears within a larger expression which uses
       the resulting value.  The same applies to a construct of the form: var += expression.  If an address of
       a variable is taken, its value is assumed to be accessed. An array, struct or union is considered accessed
       if any portion thereof is accessed.


If you have comments or questions about this bug, please post them to our   Discussion Forum


Previous Bug - Bug #767 - November 2012

Use our Interactive Demo to Run FlexeLint on our Bugs of the Month

PC-lint/FlexeLint - Product Overview

Home | Contact | Order

PC-lint and FlexeLint are trademarks of Gimpel Software
Copyright 2013, Gimpel Software, All rights reserved.