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
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: "Michael Kerrisk (man-pages)" <mtk dot manpages at gmail dot com>, Andreas Schwab <schwab at suse dot de>
- Cc: <nd at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, Igor Liferenko <igor dot liferenko at gmail dot com>
- Date: Mon, 21 Nov 2016 13:13:18 +0000
- Subject: Re: Signedness of wchar_t and wint_t leads to problems with gcc -Wsign-conversion
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- References: <CAKgNAkhjsE=OpLj=S9btNBQVj-OAr7Fd3y6RDp4M7SFkoPGHbg@mail.gmail.com> <mvm8tsd0zoq.fsf@hawking.suse.de> <CAKgNAkiZWYo4TdVhXhpiPhsdYBtMOJ0PWePTA2p1BKFBaWv=Ag@mail.gmail.com> <5832F017.7050506@arm.com> <4008cd33-2ea7-433b-4441-5a08eba1af1d@gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 21/11/16 13:06, Michael Kerrisk (man-pages) wrote:
> On 11/21/2016 02:01 PM, Szabolcs Nagy wrote:
>> On 21/11/16 12:54, Michael Kerrisk (man-pages) wrote:
>>> So, I'm not quite clear on the point that you are making in your
>>> second point. Given code such as:
>>>
>>> wchar_t w;
>>> ...
>>> if (iswlower((wint_t) w) ....
>>>
>>> Do you mean that the standards are saying that casting to wint_t here
>>> is guaranteed to be correct? I can't see the line of reasoning that
>>> leads there.
>>
>> an implementation is allowed to support wide
>> characters with >=0 value only (independently
>> of signedness of wchar_t).
>
> Yes, it's allowed to, but it may also do otherwise, as in there
> may be implementations where wchar_t runes are negative (right?).
on those systems wint_t must be signed.