varargs and scanf

Victor Gavin vic at zen.UUCP
Sat Jan 28 04:33:31 AEST 1989


I have recently had a problem in using ANSI C prototypes and vararg functions.

The function I was creating required two obligatory parameters and the rest
were optional. The function was declared

	void foo(va_alist)

My problem was that to catch any mistakes in programs which call it I used
the prototype

	extern void foo(int,int,...);

This prototype is included by the file that contains the function and so
the compiler keeps complaining about type mis-matches on parameter one.
I can understand this but I'd like to know if there is some way of explaining
to the compiler (MS C v5.1, warnings level 3) that I don't want an error
message coz the code is kosher.

My other problem is that there isn't a varargs version of scanf(). Is there
one in ANSI C or is it something that only I would find useful?

		vic
--
Victor Gavin						Zengrange Limited
vic at zen.co.uk						Greenfield Road
..!mcvax!ukc!zen.co.uk!vic				Leeds LS9 8DB
+44 532 489048						England



More information about the Comp.lang.c mailing list