[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Overriding the MS-Windows wint_t type considered harmful
From: |
Bruno Haible |
Subject: |
Re: Overriding the MS-Windows wint_t type considered harmful |
Date: |
Mon, 01 May 2017 12:27:57 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-75-generic; KDE/5.18.0; x86_64; ; ) |
I wrote:
> In the particular case of 'wint_t': The problem is no such much that
> wint_t = 'unsigned short'
> is not unchanged by argument promotions, but rather that this type
> is not larger than 'wchar_t'. This piece of code
>
> wint_t c = getwchar();
> if (c == WEOF) goto eof_handling;
>
> is only correct when wint_t is larger than wchar_t. The original
> definition of WEOF is (wint_t)0xFFFF.
Oops, gnulib actually redefines wint_t but not WEOF. I was too shy to
redefine WEOF.
So, the only reason why gnulib redefines wint_t is standards compliance
(ISO C 99 section 7.24.1.(2), to be precise).
Bruno