This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Signedness of wchar_t and wint_t leads to problems with gcc -Wsign-conversion


Hi all,

Can you please say if the typecasts in the following two programs are valid?
(I just replaced wint_t and wchar_t to their actual meaning in glibc)

    #include <locale.h>
    #include <wchar.h>
    int main(void)
    {
      setlocale(LC_CTYPE, "en_US.UTF-8");
      unsigned int wc;
      wc = getwchar();
      putwchar((int) wc);
    }

--

    #include <locale.h>
    #include <wchar.h>
    #include <wctype.h>
    int main(void)
    {
      setlocale(LC_CTYPE, "en_US.UTF-8");
      int wc;
      wc = L'ÿ';
      if (iswlower((unsigned int) wc)) return 0;
      return 1;
    }


Igor


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]