On Mon, 21 Nov 2016 13:05:24 +0100 "Michael Kerrisk (man-pages)" <
mtk.manpa...@gmail.com> wrote:
> Upstream maintainer here.
>
> I added the missing include.
>
> But I am unsure what to do about the other point (regarding gcc
> -Wconversion). There is an analogous situation with islower() and
> similar functions, where the solution is described by an update I
> recently added for the upcoming upstream release
>
>        The standards require that the argument c for these  functions  is
>        either  EOF  or a value that is representable in the type unsigned
>        char.  If the argument c is of type  char,  it  must  be  cast  to
>        unsigned char, as in the following example:
>
>            char c;
>            ...
>            res = toupper((unsigned char) c);
>
>        This  is necessary because char may be the equivalent signed char,
>        in which case a byte where the  top  bit  is  set  would  be  sign
>        extended  when converting to int, yielding a value that is outside
>        the range of unsigned char.
>
> However, we don't have a similar solution for iswlower(), because
> there is no "(unsigned wchar_t)" cast. And casting to (wint_t) seems
> incorrect to me, because if wchar_t is a signed type smaller than
> wint_t, then sign extension could occur.
>
> I could be wrong, but it seems like an implementation bug that one of
> these types is signed and the other is unsigned.
>
> Cheers,
>
> Michael
>
>


tamtam

Reply via email to