Xref: utzoo gnu.gcc:476 comp.lang.c:18221 comp.std.c:1119 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!ames!elroy!ucla-cs!uci-ics!bonnie.ics.uci.edu!sklein From: sklein@bonnie.ics.uci.edu (Steve Klein) Newsgroups: gnu.gcc,comp.lang.c,comp.std.c Subject: Variable Numbers of Args to Functions in ANSI C. Keywords: Variable Args Message-ID: <13024@paris.ics.uci.edu> Date: 30 Apr 89 07:00:00 GMT Sender: news@paris.ics.uci.edu Lines: 35 If I forward-declare the function: int func(a, b, ...); Then how do I define and call 'func'? I tried: #include int func(a, b, va_alist); int a, b; va_dcl { ... } but GNU CC says 'number of args doesn't match prototype'. Trying int func(a, b, c, d); int a, b, c, d; { ..casting c & d where appropriate.. } this, of course, moans when I call func without all 4 params: func (actual_a, actual_b); I _thought_ in ANSI C that the trailing '...' told the compiler not to check the number or types of the parameters that followed. Is there a way to do this, or does one need C++ with its overloading for this kind of stuff? I could use the -traditional switch on gcc, but I'd like _some_ kind of type checking! Is this a compiler bug or something I don't understand about ANSI?