[cfe-dev] wint_t definition

Chris Lattner clattner at apple.com
Tue Jan 5 10:27:41 PST 2010


On Jan 4, 2010, at 6:48 PM, Andrew Jeffery wrote:

> Hi all,
>
> In playing around with Clang I came across the attached C snippet  
> which compiles with GCC but fails with Clang. This appears to be  
> because GCC defines the wint_t type in stddef.h where Clang doesn't  
> (changing the wctype.h include to wchar.h does away with the whole  
> issue: wchar_t is defined and the wint_t issue becomes non-existent).

It's hard to tell without more information.  My copy of gcc (4.2)  
doesn't define wint_t in stddef.h.  However, it does pull in several  
other headers that it isn't supposed to, e.g.:

#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
#include <sys/_types.h>
#endif

which might pull it in.  GCC's stddef.h is a real nasty mess of  
macros, it's hard to tell what you might be getting.  However, in any  
case (according to C99 7.17) stddef.h isn't supposed to define wint_t,  
so I'd consider this a GCC bug.

-Chris



More information about the cfe-dev mailing list