varargs vs. prototypes

Ron Guilmette rfg at pink.ACA.MCC.COM
Sat Jun 10 07:27:46 AEST 1989


In article <10380 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <237 at pink.ACA.MCC.COM> rfg at MCC.COM (Ron Guilmette) writes:
>>So how can I write a function definition for a varargs function
>>using prototypes?  Is this possible?
>
>#include <stdarg.h>
>ret_type func_name( type1 fixed_arg1, typen fixed_argn, ... )
>	{ /* stuff using the va_* macros defined by <stdarg.h> */ }


PLEASE!  EVERYONE!  I goofed!  Please don't send me anymore messages
showing me how to do this.  I know how to use prototypes and the
stuff from <stdarg.h> (or <varargs.h>) to get at the variable parameters.
I goofed because I asked the WRONG question.

The question I meant to ask was "How can you use prototypes for a function
which can accept ZERO or more arguments?"

There appears to be NO WAY to do this.

Since I asked the original question, I been informed that I should not
even be worring about the "ZERO or more" case because, in actual practice,
it never occurs.

I'm now mostly convinced that this is true, so my (intended) question is
moot.

-- 
// Ron Guilmette  -  MCC  -  Experimental Systems Kit Project
// 3500 West Balcones Center Drive,  Austin, TX  78759  -  (512)338-3740
// ARPA: rfg at mcc.com
// UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg



More information about the Comp.std.c mailing list