Roger.Evans@itri.brighton.ac.uk wrote:
> This code assumes that a varags list is terminated by a null on the
> stack (ie not passing the number of args, as I had previously suggested).
That's an X convention, not a C convention. You have to be able to
tell when you've run out of arguments *somehow*.
The C stdarg mechanism makes it possible to transmit and receive
argument lists of unfixed length, but leaves to the programmer the
job of deciding if there are more arguments to handle.
Any code using varargs should have been converted to stdarg years
ago, unless there are real cases of Poplog targets that don't
support it. [And if there are, there are almost certainly routine
ways to code round them, by supplying fake stdarg.hs that fall back
to varargs.]
stdarg is portable, and standard; varargs probably isn't portable
any more, and definitely isn't standard.
Almost certainly any platform that had varargs implemented stdarg the
same [underlying] way - otherwise you'd have more bugs than you could
shake a large bundle of sticks at.
--
Chris "electric hedgehog" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html
C welcome: http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html
|