Variable argument lists.

Bob Fisher nts0302 at dsacg3.UUCP
Wed May 11 21:48:39 AEST 1988


In article <14139 at brl-adm.ARPA>, bates%falcon.dnet%fermat at bru.mayo.edu (Cary Bates) writes:
> 
> 
> 
>        Does anybody know (or care) why in ANSI standard C when 
>        using a variable length argument list, there is no way to 
>        determine how many arguments where passed into the function?

I have simply tested optional arguments equal to null/zero/whatever (depending
on type).  The compiler initializes the function's copy of the arugment
according to type class.

This means that the argument cannot pass the save value to which the field
is initialized.  It also means that EVERY time you exit the function, you
must reset the function's copy of the arugment.  The next time the function
is called, the value is still initialized if the argument is omitted.

Admittedly, I have used this technique only with the last argument in
the list.  I don't know if it will work with your compiler or if it will
be portable.

-- 
		- - - - - - - - - - - - - - - - - - - - - - - 
Bob Fisher @ Defense Logistics Agency Systems Automation Center, Columbus, OH
UUCP:		{uunet!gould,cbosgd!osu-cis}!dsacg1!bfisher
Phone:		614-238-9071     (Autovon 850-9071)



More information about the Comp.lang.c mailing list