Path: utzoo!attcan!uunet!wuarchive!cs.utexas.edu!yale!mintaka!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Does LINT understand ANSI prototyping? Message-ID: <18633@haddock.ima.isc.com> Date: 25 Oct 90 03:38:02 GMT References: <1990Oct24.183836.24082@portia.Stanford.EDU> Reply-To: karl@ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 32 In article <1990Oct24.183836.24082@portia.Stanford.EDU> rstanton@portia.Stanford.EDU (Richard Stanton) writes: >Does LINT not understand ANSI prototypes? Yes it does, but only if you have the latest version of lint (it's in SVR4). If you only have access to a pre-ANSI lint, you'll have to hide the prototypes from it. (I'll assume that there are no ANSIisms other than the prototypes; if this is not the case you've got more trouble than I can help you with.) If the only prototypes are in the header files, then I recommend you rewrite them to look like this: #if defined(__STDC__) extern set_t mkset(void); extern bool is_empty(set_t); extern void add_to(void const *, set_t *); #else extern set_t mkset(); extern bool is_empty(); extern void add_to(); #endif (Some people prefer to use a single set of declarations with magic macros that expand into either an empty pair of parentheses or the appropriate arglist; I don't like that convention.) In actual source code that you have to maintain, it can be painful and ugly to support both prototyped and old-style declarations; in this case I prefer to maintain the code with prototypes and, when the code needs to be viewed by a pre-ANSI tool, filter it through a deprotoizer. One such is "unprotoize", which hangs off of gcc and should be available in the various GNU archives. I maintain a less powerful one that's entirely self-contained (available on request, but it's tuned to my personal coding style). Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint