wint_t has invalid definition?

Todd Vierling tv@wasabisystems.com
Tue Oct 10 09:29:00 GMT 2000


This hit the NetBSD bug database:

>Synopsis:       gcc redefines wint_t (defined in /usr/include/wchar.h)
>	lang/gcc doesn't properly fix the system include files when generating
>the contents of /usr/pkg/gcc-2.95.2/lib/gcc-lib/i386--netbsdelf/2.95.2/include.
>The header stddef.h redefines wint_t, which is previously defined in the
>system header /usr/include/wchar.h.

The NetBSD definition on all current platforms is (collapsing CPP macros):

  typedef int wchar_t;
  typedef int wint_t;

However, the gcc 2.95.2 stddef.h override shows (collapsing CPP macros):

  typedef int wchar_t; /* from _BSD_WCHAR_T_, but same as stddef.h default */
  typedef unsigned int wint_t;

The Single UNIX Specification, version 2, states for <wchar.h>:

  wint_t
  An integral type capable of storing any valid value of wchar_t, or WEOF.

Note that NetBSD defines _BSD_WINT_T_ to make its definition using the same
semantics as _BSD_SIZE_T_, so this macro should be used to typedef it.  (I
can supply a patch for this, if desired.)

However, the SUSv2 citation implies, to me, that wint_t should also default
to the same type as wchar_t--in other words, (signed) int--as the unsigned
version cannot properly store the possibly negative wchar_t values.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  http://www.wasabisystems.com/
-- Speed, stability, security, and support.  Wasabi NetBSD:  Run with it.



More information about the Gcc-bugs mailing list