bug-gnulib
[Top][All Lists]
Advanced

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

Re: check for C99-compliant snprintf


From: Bruno Haible
Subject: Re: check for C99-compliant snprintf
Date: Tue, 20 Feb 2007 04:40:27 +0100
User-agent: KMail/1.5.4

Ben Pfaff wrote on Friday/Saturday:
> The following patch attempts to remedy the situation.

I cannot see the big picture in this change. You want a snprintf() whose
return value is correct but which still doesn't support argument reordering
on NetBSD and doesn't support %n on HP-UX? And an unchanged printf() and
fprintf()? Please see the other mail ("Printf for gnulib") for a proposal
how to get it all right.

> I traced it to the following in libintl.h:
>     #undef snprintf
>     #define snprintf libintl_snprintf
> where libintl_snprintf is a wrapper around the system snprintf,
> which is still of course broken.  I'm not sure how to work around
> this problem.

Don't worry about it yet. We can get it fixed afterwards.

> vsnprintf is problematic even with --disable-nls, because mingw
> <stdio.h> contains:
>     __CRT_INLINE int __cdecl
>     vsnprintf (char* s, size_t n, const char* format, __VALIST arg)
>       { return _vsnprintf ( s, n, format, arg); }
> When vsnprintf expands to rpl_vsnprintf, this turns rpl_vsnprintf
> into a wrapper around the broken _vsnprintf.

The usual way to work around such redefines in header files is to
write an <stdio.h> substitute which #includes the original <stdio.h>
and _then_ does
  #define vsnprintf rpl_vsnprintf

This way, you don't even need to know about _vsnprintf.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]