availability of ANSI-conformant compilers

Doug Gwyn gwyn at smoke.brl.mil
Sun Nov 18 01:21:36 AEST 1990


In article <16457 at csli.Stanford.EDU> poser at csli.stanford.edu (Bill Poser) writes:
>Doesn't this mean that you either don't use prototypes or have to
>include both a prototype and a non-prototyped declaration for every
>function?

There is no requirement to use prototypes even in an ANSI C environment.
However, in fact we do use them, in order to obtain the benefit of
compile-time parameter type checking ("lint" can also do this) and
especially possible violations of "const" parameter qualification.

While we don't do anything particularly slick in declaring functions
both ways, there are methods for automating this, e.g.
	/* in your system configuration header: */
	#ifdef __STDC__
	#define ARGS(args)	args
	#else
	#define	ARGS(args)	()
	#endif

	/* in your module/package headers: */
	#include "std.h"	/* the above system configuration header */
	extern bool FunkyFunc ARGS((int number, char *name));
	/* etc. */
You could also do something similar for function definitions.



More information about the Comp.lang.c mailing list