Re: g_printf_string_upper_bound (#50217)



Shawn T Amundson <amundson eventloop com> writes:

> Is g_strdup_vprintf supposed to work the same cross-platform?
> 
> If so, shouldn't g_printf_string_upper_bound simply conform to 
> ISO C instead of handling non-ISO C additions?  
> 
> If not, should there be two versions - a glibc-based version and
> a ISO C version.  The ISO C version could print warnings if
> non-ISO C additions were used on a non-glibc operating system.

Two versions certainly aren't right. The current intention is
to try to transparently pass stuff through to the system printf
whatever it supports.

That does make things difficult/impossible for 
g_printf_string_upper_bound(), since with GLibc, it's even
possible to hook in entirely new types of format characters.

So, I wouldn't object if we limited ourself to the C99 set. With
the problem, though, that systems may well not support all of
those, and there is nothing much we can do about it.

(Supplying our own printf implementation is highly non-trivial,
glibc includes a multi-precision arithmetic library to handle 
getting %f correct to the last bit....)

Also, I'd really like to see g_strdup_printf() use vasprintf()
when available; it's going to be more space efficient, and I
suspect it will be faster, even if we have to g_strdup() afterwards
when g_malloc() isn't a direct wrapper of malloc().

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]