This is the mail archive of the gcc@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: 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....


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