Click on image to see enlargment

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


@module graduation.c 
1    #include "grad.h"
2    extern String *graduates;
3    extern String *deans_list;
4    int count(String *);
5    int main()
6        {
7        return count(deans_list);
8        }

@module count.c 
1    #include "grad.h"
2    String deans_list[100];
3    int count( String *list )
4        {
5        int sum = 0;
6        int i;
7        for( i = 0; list[i]; i++ )
8            ++sum;
9        return sum;
10       }

@header grad.h 
1    //lint -u program not complete
2    typedef char *String;

This multi-module program is intended to count the number of students that made the dean's list in this spring's graduation but something is going horribly wrong. Note: it is given that the last student's name is followed by the traditional NULL. lint Output

=== Multiple Modules:

--- Module:   graduation.c (C)

    --- Wrap-up for Module: graduation.c

Info 752: local declarator 'graduates' (line 2, file graduation.c) not

--- Module:   count.c (C)
    String deans_list[100];
count.c  3  Error 18: Symbol 'deans_list' redeclared (basic) conflicts with
    line 3, file graduation.c 
count.c  11  Info 818: Pointer parameter 'list' (line 4) could be declared as
    pointing to const

Reference Manual Explanation

18     Symbol 'Symbol' redeclared (TypeDiff) conflicts with Location  --
       A symbol is being redeclared.  The parameter TypeDiff provides
       further information on how the types differ.  Location is the
       location of the previous definition.

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

Previous Bug - Bug #845 - May 2010

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