Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Function with variable number of arguments

Reply
Thread Tools

Function with variable number of arguments

 
 
Nimmi Srivastav
Guest
Posts: n/a
 
      09-13-2005
Consider two functions A and B, both of which accept a variable number
of arguments (va_start, va-arg, va_end). Is there an easy way for
arguments passed to A to be, in turn, passed to B? (For example, if A
is a wrapper function around B).

Thanks,
Nimmi

 
Reply With Quote
 
 
 
 
Gordon Burditt
Guest
Posts: n/a
 
      09-13-2005
>Consider two functions A and B, both of which accept a variable number
>of arguments (va_start, va-arg, va_end). Is there an easy way for
>arguments passed to A to be, in turn, passed to B? (For example, if A
>is a wrapper function around B).


The main (and probably ONLY) reason for the existence of functions
like vfprintf(), vsprintf(), etc. is that you CANNOT pass on a
variable argument list from one varargs function to another varargs
function. You can, however, pass a variable argument list to a
function taking a va_list (like vprintf(), vsprintf(), etc.).
Typically, the function taking the variable argument list is the
wrapper, and the one taking the va_list does the work.

Gordon L. Burditt
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a function that expects variable arguments from a functionwith variable arguments Navaneeth C Programming 4 11-20-2010 05:35 AM
Call again a variadic function (... variable number of arguments)with same arguments that its variadic wrapper moreau.steve@gmail.com C Programming 3 12-31-2008 07:13 AM
how to pass a function name and its arguments inside the arguments of other function? jmborr Python 1 11-03-2007 08:20 AM
Variable number of arguments when calling a DLL function Vince C++ 3 11-10-2004 05:57 PM
variable number of arguments + function pointers Alex C++ 1 10-16-2003 10:31 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57