Article View: gnu.gcc.help
Article #53380type checking with gcc
From: Charlie Hileman
Date: Thu, 09 Jan 1992 15:45
Date: Thu, 09 Jan 1992 15:45
36 lines
1766 bytes
1766 bytes
We've been using lint for developing over the last few years. Lately,
we're making a move towards using gcc with ANSI, but we still must
keep our functions defined in the traditional fashion, since we need
to port our code over to many machines without ANSI compilers.
Are the type-checking capabilities of gcc with ANSI any substitute for
lint? I noticed that many parameter differences we're ignored using
gcc, and caught with lint. A small example:
------------------------
typedef enum { BAR1 } BAR_EVAL;
BAR_EVAL foo_eval ( foo )
BAR_EVAL foo;
{ foo = BAR1; return foo; }
BAR_EVAL bar() { return foo_eval(2); }
------------------------
Error back from lint on file "foo2.c":
foo_eval, arg. 1 used inconsistently foo2.c(5) :: foo2.c(7)
No error back from "gcc -Wall -ansi -c foo2.c".
Of course, I tried out other cases, such as passing in a character
where a float was expected. No error from gcc.
If gcc doesn't provide such error checking, what substitutes for lint
are out there? (I'm no great fan of lint). I'd like to see something
that uses the prototypes, instead of depending on lint libraries.
Thanks!
--Charlie Hileman ARPA: chaz@vicorp.com
V. I. Corporation UUCP: uunet!vicorp!chaz
Northampton, Massachusetts
Technical Details
Message-ID:
<1992Jan9.154511.9240@vicorp.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!vicorp!chazShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,a7ee8f525dc565b0,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-01-09 08:27:32 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!vicorp!chaz From: chaz@vicorp.com (Charlie Hileman) Subject: type checking with gcc Message-ID: <1992Jan9.154511.9240@vicorp.com> Organization: V. I. Corporation, Northampton, Massachusetts Distribution: usa Date: Thu, 9 Jan 92 15:45:11 GMT