Re: How to build va_list on 64bit Intel/darwin?
Re: How to build va_list on 64bit Intel/darwin?
- Subject: Re: How to build va_list on 64bit Intel/darwin?
- From: Terry Lambert <email@hidden>
- Date: Wed, 09 Sep 2009 12:42:32 -0700
On Sep 9, 2009, at 5:20 AM, lbland <email@hidden> wrote:
hi-
On 32-bit, I can build a va_list by hand (using simple pointer
arithmetic) and call functions that accept va_list.
But, on 64-bit the va_list changed and the way I build va_list on 32-
bit does not work.
Are there some functions that I can uses to push variables onto the
va_list (stack)? - maybe even cross-platform GNU functions?
... ANSI-C defines how to pop them off, but I can't find a good way
to push them on.
thanks!-
-lance
You're looking in the wrong direction by looking for GNU functions.
About the only use for this would be in-flight hacking of the
arguments to a varradic function before passing them off to another,
second varradic function, either insertion or deletion. Otherwise you
would just make the call to the second function. For almost all printf-
like functions you can simple make multiple calls to the underlying
function, since they are appending data to an unflushed memory buffer
in any case, so there should be no real performance impact since
things are being write gathered into the I/O buffer anyway.
It's possible to do, but it would be handier to see how you're
currently doing it so we could tell you what you were doing wrong.
Typically it tends to be a mistake in alignment on the basis of
incorrect assumptions about alignment boundaries and packing for a
given ABI, typically dealing with type promotion to wider types.
It's also why the POSIX standard states that what you want to do is
undefined, and why most people go to great lengths to avoid doing it,
and why it typically can not be done portably. See also section 15.13
of the C language FAQ.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden