passing parameter list of one function to another

N

Neil Zanella

Hello,

Consider the following function prototype:

foo(int, ...);

Inside the body of function foo I want to call another function whose
signature is given as follows:

bar(int, ...);

No matter how many parameters are passed to foo, I want bar to be called
with the exact same parameter list. Is it possible to do this?

Thanks,

Neil
 
J

James Hu

Consider the following function prototype:

foo(int, ...);

Inside the body of function foo I want to call another function whose
signature is given as follows:

bar(int, ...);

No matter how many parameters are passed to foo, I want bar to be called
with the exact same parameter list. Is it possible to do this?

This is a comp.lang.c FAQ. Please refer to the answer to question
15.12 of the C-faq.

http://www.eskimo.com/~scs/C-faq/top.html

-- James
 
R

Ravi Uday

Neil Zanella said:
Hello,

Consider the following function prototype:

foo(int, ...);

Inside the body of function foo I want to call another function whose
signature is given as follows:

bar(int, ...);

No matter how many parameters are passed to foo, I want bar to be called
with the exact same parameter list. Is it possible to do this?

You may need to look at variable-argument list functions
va_arg, va_end, va_start, vsprintf etc..

- Ravi
 
P

Peter Shaggy Haywood

Groovy hepcat Neil Zanella was jivin' on Sat, 29 Nov 2003 23:58:21
-0330 in comp.lang.c.
passing parameter list of one function to another's a cool scene! Dig
it!
Consider the following function prototype:

foo(int, ...);

Inside the body of function foo I want to call another function whose
signature is given as follows:

bar(int, ...);

No matter how many parameters are passed to foo, I want bar to be called
with the exact same parameter list. Is it possible to do this?

This has been answered here more than once recently. It is also in
the FAQ. The fact that you are asking this question indicates that you
have not a) read the FAQ or b) lurked in the newsgroup for any length
of time, both of which you should have done before posting. This is
very rude, not to mention a waste of bandwidth (which forces the cost
of Net access up - and I'm sick of paying for people who keep asking
the same questions all the time!). Stop doing that! Lurk for at least
a month. Read the FAQ (http://www.eskimo.com/~scs/C-faq/top.html).
Please do not post again until you have done so.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top