On Tue, 1 Mar 2005 22:42:52 +0100, Joerg Hessdoerfer
<Joerg.Hessdoerfer@sea-gmbh.com> wrote:
>
> Some stupid idea just crossed my mind: what if the /ports version just
> re-arranges the va_list according to the positional args and calls
> vsnprintf()?
> At least we know compiler and library...
I thought about it a lot. Some platforms do not support
all of % formant strings. src/port/snprintf.c is used both
for the platforms that do not support all necessary
% modifiers and the ones that do not support %n$
modifiers. Here is a comment from configure:
# If we found "long int" is 64 bits, assume snprintf handles it. If
# we found we need to use "long long int", better check. We cope with
# snprintfs that use %lld, %qd, or %I64d as the format. If none of these
# work, fall back to our own snprintf emulation (which we know uses %lld).
Any comments on this idea? Should we have two
versions of snprintf.c for these occasions?
> Or, another idea: why not format the va_args individually using the original
> format specifiers alone (without positional args), and assemble the resulting
> string?
That is exactly what the code does :)
> Greetings,
> Jörg
Nick