Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!ncar!ico!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: selectively enabling prototypes Message-ID: <17424@haddock.ima.isc.com> Date: 15 Aug 90 23:24:47 GMT References: <493@mtndew.Tustin.CA.US> <1990Aug13.172452.14217@ingres.Ingres.COM> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 38 In article <1990Aug13.172452.14217@ingres.Ingres.COM> daveb@llama.Ingres.COM (here kitty, kitty...) writes: >In <493@mtndew.Tustin.CA.US> friedl@mtndew.Tustin.CA.US (Steve Friedl) writes: >>[I like to use:] >> #ifdef USE_PROTO >> # define PROTO(name, args) name args >> #else >> # define PROTO(name, args) name ( ) >> #endif >> extern PROTO(char *strcpy, ( char *, const char * ) ); >>However, I have seen it done "the hard way": >> #ifdef USE_PROTO >> extern char *strcpy(char *, const char * ); >> #else >> extern char *strcpy(); >> #endif >>This looks like a real maintenance nightmare... Interesting; I would have said that the *former* method looks nightmarish. >Numberous people believe tha answer is really to write a filter that >turns ANSI code into Classic-C code, That's what I recommend, and what I use for myself%. >inserting all the casts into function calls as needed. [But no such program >exists.] Wait a minute; now you've changed the problem. The original two proposals didn't handle the situation of mismatched argument types in a Classic C environment, so it's unfair to make that a requirement. The tool I use isn't an ANSI-to-Classic converter, but it is a sufficiently powerful deprotoizer for my purposes. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint ________ % In .c files and in single-project .h files, anyway. Global header files tend to be static, so I just write them once, using what Steve calls the "hard way", and then ignore them once they're installed.