This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
wint_t has invalid definition?
- To: gcc-bugs at gcc dot gnu dot org
- Subject: wint_t has invalid definition?
- From: Todd Vierling <tv at wasabisystems dot com>
- Date: Tue, 10 Oct 2000 12:37:08 -0400 (EDT)
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.