One difference between uClibc and glibc

Jie Zhang jzhang918 at gmail.com
Thu Mar 23 12:58:28 UTC 2006


On 3/23/06, Rich Felker <dalias at aerifal.cx> wrote:
> 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.
>
I understand that that test program is not C99 conforming. But
currently gcc default supports C90 (plus some gnu extensions). So it
should be OK to be compiled with gcc and linked with a C90 conforming
C library. It appears that uClibc is not C89 conforming, since it's
not allow user to redefine snprintf () or vsnprintf ().

To solve it, one option is to enclose their definitions by
__USE_ISOC99. And we also may need to add a configuration allow user
to choose building a C89 library or C99 library. Another is to define
them as weak symbols of __snprintf and __vsnprintf respectively,
without any configurations. Such that for C90, these two functions
will be treated as extensions and can be redefined.

I don't like the first option. If only C89 uClibc is installed, only
C89 programs can be built. If both are installed, gcc needs be teached
to connect to different c libraries with different C language standard
option. My proposed patch is to take the second option.

Jie



More information about the uClibc mailing list