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

            bug722.cpp

1    int a[10000];
2
3    void f()
4
5        {
6        int i;
7
8        for( i = 0; i < 10000; i++);
9             a[i] = i;
10       }

This function is supposed to initialize a global array, but something isn't working. Can you or your compiler see the problem?


bug722.cpp lint Output

--- Module:   bug722.cpp 
                              _
    for( i = 0; i < 10000; i++);
bug722.cpp(8) : Info 722: Suspicious use of ;
         _
         a[i] = i;
bug722.cpp(9) : Warning 539: Did not expect positive indentation from line 8
bug722.cpp(9) : Warning 661: Possible access of out-of-bounds pointer (1 beyond
    end of data) by operator '['


Reference Manual Explanation

 
722    Suspicious use of ;  -- A semi-colon was found immediately to the
       right of a right parenthesis in a construct of the form while(e);
       or for(e;e;e);.  As such it may be overlooked or confused with
       the use of semi-colons to terminate statements.  The message will
       be inhibited if the ';' is separated by at least one blank from
       the ')'.  Better, place it on a separate line.


Previous Bug - Bug # 415 - October 2000

PC-lint/FlexeLint - Product Overview

Home | Contact | Order

PC-lint and FlexeLint are trademarks of Gimpel Software
Copyright © 2003, Gimpel Software