Click on image to see enlargment

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

            bug603.c

1    #include <stdio.h>
2    #include <string.h>
3    char *sequence =
4      "rocket aerial ball mortar mortar aerial";
5    void unique( const char *list, char *buf )
6        {
7        char name[100];
8        int k;
9        buf[0] = 0;
10       for(;;)
11           {
12           while( *list == ' ' ) list++;
13           k = sscanf( list, "%s", name );
14           if( k != 1 ) break;
15           if( !strstr( buf, name ) )
16               { strcat( buf, " " );
17                 strcat( buf, name ); }
18           list += strlen(name);
19           }
20       }
21   int main()
22       {
23       char types[1000];
24       unique( types, sequence );
25       printf( "Fireworks used: %s\n", types );
26       return 0;
27       }

Mike is automating his fireworks this year but is encountering a bit of a problem with this code. It's supposed to take a blank separated list and deduce its unique items, but something is going awry.


bug603.c lint Output

--- Module:   bug603.c (C) 
                             _
    unique( types, sequence );
bug603.c(24) : Warning 603: Symbol 'types' (line 23) not initialized

Reference Manual Explanation


603    Symbol 'Symbol' (Location) not initialized  -- The address of the named symbol is being
       passed to a function where the corresponding parameter is declared as pointer to const.
       This implies that the function will not modify the object.  If this is the case then the
       original object should have been initialized sometime earlier.


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


Previous Bug - Bug #846 - June 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 2012, Gimpel Software, All rights reserved.