Path: utzoo!attcan!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: Follow up to How Do I Prototype this? Message-ID: <300@taumet.com> Date: 3 Jul 90 15:45:49 GMT References: <351@demott.COM> Reply-To: steve@taumet.UUCP (Stephen Clamage) Organization: Taumetric Corporation, San Diego Lines: 29 In article <351@demott.COM> kdq@demott.COM (Kevin D. Quitt) writes: > BTW, my compiler accepts: >int foo( int, ... ); > but rejects: >int foo(...); > and calls the ... a syntax error. Anyone: is the above declaration >ANSI, or K&R, or none of the above? Your compiler is correct. ANSI C requires at least one parameter declaration to precede the ellipsis (...). It also requires the ellipsis notation in the prototype and definition of any function which takes a variable number of arguments (in a conforming program). Of course, the ellipsis must occur at the end of the parameter list. This is covered in the syntax section of 3.5.4 of the ANSI standard, and elaborated in 3.5.4.3. The feature interacts with the typedef and macros in standard header , in section 4.8. This means that there is no portable way to declare and use a function which may take zero or more arguments, or whose first argument might be of any type. How does one write a function which might or might not have a first argument of any type? However you do it, I suspect the program would be very difficult to understand and maintain. Some re-thinking of the program design would be in order. -- Steve Clamage, TauMetric Corp, steve@taumet.com