Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: varargs and scanf Keywords: vfprintf, ANSI C,... Message-ID: <9553@smoke.BRL.MIL> Date: 1 Feb 89 22:25:30 GMT References: <1494@zen.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 24 In article <1494@zen.UUCP> vic@zen.UUCP (Victor Gavin) writes: >The function I was creating required two obligatory parameters and the rest >were optional. The function was declared > void foo(va_alist) I think you mean that was the declaration used in the function definition? That's not ANSI C in any case. For ANSI C you must use the ",..." form of declaration/definition for varargs functions. va_alist belongs to the old , not ANSI C and . >My problem was that to catch any mistakes in programs which call it I used >the prototype > extern void foo(int,int,...); That's okay. Fix the function definition to have the same shape. >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? No, v*scanf() are not in the proposed ANSI C Standard. In fact there was considerable sentiment for removing the normal *scanf() functions. I'm not sure how useful v*scanf() would be; I've never felt the need for it, though.