This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Passing va_args...
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Jean-Yves Bitterlich'" <Jean-Yves dot Bitterlich at benq dot com>, <kalaky at gmail dot com>, <jairo dot balart at bsc dot es>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Thu, 9 Mar 2006 13:29:37 -0000
- Subject: RE: Passing va_args...
On 09 March 2006 13:11, Jean-Yves Bitterlich wrote:
Jean, do you know you're replying to an email from October 2005? Ah well, I
see the thread ended without all the information coming out, Andreas said it
was impossible but didn't go into the details so it's worth mentioning the
builtins.
>> Kalaky <kalaky@gmail.com> writes:
>>
>> > I'am looking for some way to pass variable arguments to another
>> > function that receives variable arguments without using va_list.
>>
>> This is impossible.
>
> what about?
> #define DOTS ...
>
> function_1 (int z, ...);
> function_2 (int z, ...);
> {
> return function_1 (z, DOTS);
> }
Why would substituting a macro for '...' suddenly make the nonsense
statement
return function_1 (z, ...);
mean anything? That won't even compile, let alone do what you want.
It may be impossible in practice, but it is supposed to be possible to do
this, depsite what Andreas Schwab wrote two messages (and five months)
upthread. Gcc has some functions such as __builtin_apply_args,
__builtin_apply and __builtin_return that let you attempt this, but they are
very tricky features to get right and may fail on some platforms or in some
corner cases. See the gcc manual section on constructing function calls, at
http://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html#Constructing-Calls
cheers,
DaveK
--
Can't think of a witty .sigline today....