One difference between uClibc and glibc

Rich Felker dalias at aerifal.cx
Thu Mar 23 10:26:55 UTC 2006


On Thu, Mar 23, 2006 at 06:00:57PM +0800, Jie Zhang wrote:
> On 3/23/06, Rich Felker <dalias at aerifal.cx> wrote:
> >
> > IMO this is a non-issue. Any program that defines an external symbol
> > named snprintf is not a conforming C program. Whatever this test
> > program redefining snprintf is, it should be fixed...
> >
> I have any C standards at hand. But from uClibc/include/stdio.h:
> 
> #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
> __BEGIN_NAMESPACE_C99
> /* Maximum chars of output to write in MAXLEN.  */
> extern int snprintf (char *__restrict __s, size_t __maxlen,
>                      __const char *__restrict __format, ...)
>      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
> 
> extern int vsnprintf (char *__restrict __s, size_t __maxlen,
>                       __const char *__restrict __format, __gnuc_va_list __arg)
>      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
> __END_NAMESPACE_C99
> #endif
> 
> it seems snprintf () and vsnprintf () are only in C99. For C89/90, we
> should be able to redefine snprintf () and vsnprintf () in conforming
> user program.

Fair enough, if it's the intent to support C89/90. At the very least
however, C programs which depend on C89 behavior which is incompatible
with C99 should probably be updated to fix this dependency.

Rich




More information about the uClibc mailing list