ANSI C prototypes

J.T. Conklin jtc at van-bc.wimsey.bc.ca
Wed Oct 31 02:40:58 AEST 1990


In article <1005 at christopher-robin.cs.bham.ac.uk> ptf at uk.ac.bham.cs (Paul Flinders <FlindersPT>) writes:
>
>This works fine _except_ for varargs functions eg.
>
>in foo.h:
>	extern void ddprintf(const char *fmt, ...);
>
>BUT in foo.c:
>
>	void ddprintf(va_alist)
>	va_dcl;

You seem to be using the old style <varargs.h> interface which is not
compatible with prototypes.  Try something like

	#include <stdarg.h>

	void
	ddprintf(const char *fmt, ...)
	{
		va_list	args;

		va_start(args, fmt);
		vfprintf(stderr, fmt, args);
		va_end(args);
	}

    --jtc

-- 
J.T. Conklin	UniFax Communications Inc.
		...!{uunet,ubc-cs}!van-bc!jtc, jtc at wimsey.bc.ca



More information about the Comp.lang.c mailing list