lint() and #include files

Jim Franklin jwf at vaxine.UUCP
Wed Jul 11 07:58:16 AEST 1984


Is lint supposed to understand lexical scope?  I have two files "foo.c"
and "foo.h", where "foo.h" declares local variables for "foo.c":

----- file foo.h: ----------------------------------------------

static  int     abc;

----- file foo.c: ----------------------------------------------

#include "foo.h"

main ()
{
        printf ("%d\n", abc);
}

----------------------------------------------------------------

If I run lint (BSD 4.2)  on foo.c I get what I consider to be bogus
error messages:

> lint foo.c
foo.c:
abc defined( ./foo.h(1) ), but never used
abc used( foo.c(5) ), but not defined

If I make variable "abc" be external by removing the keyword static
then lint is happy.  Is this a bug or a feature?  I know that I can use
the -u switch to make this message go away, but why should I have to?



More information about the Comp.lang.c mailing list