This simple C program fails to compile when using glibc 2.8 (I'm using gcc 4.3.0 on Fedora 9). #include <wchar.h> #include <wctype.h> #include <stddef.h> ptrdiff_t i; The error is: foo.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘i’ The error is because the typedef for ptrdiff_t was not defined by <stddef.h>. That happens because wctype.h does this: /* Get wint_t from <wchar.h>. */ # define __need_wint_t # include <wchar.h> Unfortunately, if the program has already #included <wchar.h>, then _WCHAR_H is defined and <wchar.h> does nothing, including not doing a #undef of __need_wint_t. The presence of the __need_wint_t then causes <stddef.h> to only define wint_t, and not define the types it should normally define when it is included directly. It seems to me that either wctype.h should not #include wchar.h, or wchar.h should reliably #undef __need_wint_t.
Changed in cvs.