This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: variadic function


Here is the answer:

In general, you cannot. Ideally, you should provide a version of that 
other function which accepts a va_list pointer (analogous to vfprintf; 
see question 15.5). If the arguments must be passed directly as actual 
arguments, or if you do not have the option of rewriting the second 
function to accept a va_list (in other words, if the second, called 
function must accept a variable number of arguments, not a va_list), no 
portable solution is possible. (The problem could perhaps be solved by 
resorting to machine-specific assembly language; see also question 
15.13.)

which is somewhat limited!

On 19 Oct 2003, Falk Hueffner wrote:

> Pierre Laplante <laplante@sednove.com> writes:
> 
> > If I want to implement a function
> > 
> > f1(char *fmt, ...) {
> >   f2(fmt, ...);
> > }
> > 
> > where f2 is defined as
> > 
> > f2(char *fmt, ...) {
> > }
> > 
> > that want to call f2 which is itself a variadic function. How can
> > I implement this using stdarg?
> 
> See the C FAQ (www.eskimo.com/~scs/C-faq/top.html)
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]