This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with new stdarg implementation (gcc >= 2.9x)
- To: Yuri Pudgorodsky <yur at ptci dot ru>
- Subject: Re: Problem with new stdarg implementation (gcc >= 2.9x)
- From: Richard Henderson <rth at cygnus dot com>
- Date: Thu, 21 Oct 1999 09:24:55 -0700
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- References: <380EE93D.86D378F6@ptci.ru>
On Thu, Oct 21, 1999 at 02:21:49PM +0400, Yuri Pudgorodsky wrote:
> memcpy(datum, va_arg(ap, typeof(char[size])), size);
What exactly did you think this was doing? It's not
surprising at all that it doesn't do what you think.
> I cannot find a workaround, how can someone code the same task:
> takes a variable-sized structure passed by value from a
> function with (...).
You don't.
> I have the only idea for today: throw away
> gcc's builtin stdarg implementation, and use some old portable
> C-only implementation to traverse ap manually.
There is no portable implementation. Period.
The only portable way to pass a variable amount of data is to
pass it by reference and make a copy in the callee (if needed).
r~