selectively enabling prototypes

Karl Heuer karl at haddock.ima.isc.com
Thu Aug 16 09:24:47 AEST 1990


In article <1990Aug13.172452.14217 at ingres.Ingres.COM> daveb at llama.Ingres.COM (here kitty, kitty...) writes:
>In <493 at mtndew.Tustin.CA.US> friedl at 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 at 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.



More information about the Comp.lang.c mailing list