This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Signedness of wchar_t and wint_t leads to problems with gcc -Wsign-conversion
On Nov 21 2016, Zack Weinberg <zackw@panix.com> wrote:
> However, it is not clear to me that actual implementations honor that
> requirement. Consider the case where wchar_t is signed short (this
> hypothetical implementation is limited to the BMP), wint_t is signed
> int, and WEOF == ((wint_t)-1). Then (wint_t)U+FFFF is
> indistinguishable from WEOF. Yes, U+FFFF is a reserved codepoint, but
> it's still wrong for it to collide.
WEOF must be defined "to a constant expression of type wint_t whose
value does not correspond to any member of the extended character set."
This guarantees that there cannot be a conflict with valid values of
wchar_t.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."