Click on image to see enlargment

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

            bug578.cpp

1    #include <stdio.h>
2    #define Knots
3    const double standard_rating = 10.0 Knots;
4    double rating;
5    void rate_the_ship( double, double, int, double );
6    int main()
7        {
8        rate_the_ship( 64.0, 45.3, 3, standard_rating );
9        printf( "%g\n", rating );
10       return 0;
11       }
12   void rate_the_ship( double LWL, double sailarea,
13                       int nsails, double rating )
14       {
15       rating *= (3.2/LWL) * sailarea * .025 * nsails;
16       return;
17       }

For the big Labor Day (mixed boat) regatta, Mike, a better sailor than programmer, wanted to apply the latest yacht racing formulae for the competing ships. But something is going wrong with this test program. What is it?


bug578.cpp lint Output


--- Module:   bug578.cpp (C++)
    _
    {
bug578.cpp(14) : Warning 578: Declaration of symbol 'rating' hides symbol 'rating' (line 4)
    _
    }
bug578.cpp(17) : Warning 550: Symbol 'rating' (line 13) not accessed

Reference Manual Explanation


578    Declaration of symbol 'Symbol' hides symbol 'Symbol' (Location) -- A local symbol
       has the identical name as a global symbol (or possibly another local symbol).
       This could be dangerous.  Was this deliberate?  It is usually best to rename
       the local symbol.


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


Previous Bug - Bug #522 - August 2008

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 2009, Gimpel Software, All rights reserved.