Ian Piumarta <[EMAIL PROTECTED]> writes:

> On Jun 20, 2007, at 8:20 AM, Michael FIG wrote:
>
>> I could really use variadic methods.  I seem to recall they were being
>> discussed earlier, but I can't find an archive.
>
> These haven't worked for a while.  The Parser does still recognise
> '...' at the end of a method pattern but the Encoder doesn't
> implement the method required to deal with it.  If you can think of a
> nice syntax to represent 'the next unnamed variadic argument' (i.e.,
> the thing that would be translated as 'va_arg(ap, oop)') I'd happily
> reinstate it.

I would suggest a simple change from the existing code: just introduce
the following for methods that have "..." at the end of their
arguments:

  va_list nextArgument;
  va_start(nextArgument, v_lastNamedArg);
  [...]

then, before every return in the function, put:
  va_end(nextArgument);

It's fine to have the user be the one to do:

  { v_myvar = va_arg(nextArgument, oop); }

> Unfortunately there's no easy way to implement the equivalent C code
> inside curlies, since the va_list would go out of scope at the
> closing '}' of its declaration.

Yeah.  As long as the compiler manages the va_list, then I think it's
okay for the user to invoke the va_* macros directly.

Thanks,

-- 
Michael FIG <[EMAIL PROTECTED]> //\
   http://michael.fig.org/    \//
_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to