Path: utzoo!attcan!uunet!lll-winken!ames!xanth!mcnc!ecsvax!dukeac!bet From: bet@dukeac.UUCP (Bennett Todd) Newsgroups: comp.lang.c Subject: Re: typechecking Keywords: typechecking, lint Message-ID: <1192@dukeac.UUCP> Date: 18 Jan 89 08:22:21 GMT References: <19620@uflorida.cis.ufl.EDU> Reply-To: bet@dukeac.UUCP (Bennett Todd) Organization: Radiology, Duke Med. Center, Durham, NC Lines: 26 To get gcc to typecheck parameters to functions you need to have function prototypes. I have an include file (I posted it here earlier) which contains ANSI-style function prototypes for all the routines in sections 2 and 3 of the UNIX Programmer's Manual. I've since enhanced it to include proper "const" qualifiers (as best I can, I might have still missed some) so that I now can compile with gcc's "-Wall -Wwrite-strings" options, which gives pretty aggressive checking. If anybody is interested in this file let me know. As it stands it #include's everything under the sun; I like this. It doesn't seem to incur any run-time overhead in space or time (by which I mean to say that the unneeded declarations and includes don't seem to change the generated code) and I don't have to #include any of the system files. If you didn't like this behavior the file could be split into separate sets of function prototypes which could be imbedded (within #ifdef __STDC__ / #endif) in the appropriate /usr/include files. Specifically, to get gcc to give the desired warning on the common error fprintf("format", args); (omitting the needed stream parameter) you would want the following prototype in scope: int fprintf(FILE *, const char *, ...); -Bennett bet@orion.mc.duke.edu