[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 16-bit wchar_t on Windows and Cygwin
From: |
Bruno Haible |
Subject: |
Re: 16-bit wchar_t on Windows and Cygwin |
Date: |
Thu, 3 Feb 2011 11:48:48 +0100 |
User-agent: |
KMail/1.9.9 |
Corinna Vinschen wrote:
> isn't wwchar_t equivalent to wint_t on all
> platforms? On UCS-4 platforms sizeof(wint_t) == sizeof(wchar_t) == 4
> because there's no reason to make it bigger. On UCS-2 and UTF-16
> platforms sizeof(wint_t) == 4 because it must be able to hold EOF as
> well. So, why not just use the wint_t type for the time being?
The "must be able to hold WEOF as well" argument holds for the argument
type of iswwalpha. If we were to call it 'wwint_t', it would be the same as
'wint_t', yes. For this reason, we don't need a separate type 'wwint_t'.
But 'wwchar_t' is the base type for wide wide character _arrays_.
Such arrays don't need to hold the WEOF value. On AIX platforms, where
wchar_t[] is the UCS-2 encoding, wwchar_t[] can be synonymous to it.
There is no need to make wwchar_t 32 bits wide on these platforms.
So, my current code looks like this:
# if (defined _WIN32 || defined __WIN32__) || defined __CYGWIN__
/* Define 'wwchar_t' as a type that
- can hold 32 bits, unlike wchar_t which can hold only 16 bits,
- promotes to 'wint_t' under the default argument promotions. */
typedef wint_t wwchar_t; /* actually 'unsigned int' or 'uint32_t' */
# else
typedef wchar_t wwchar_t;
# endif
Bruno
--
In memoriam Buddy Holly <http://en.wikipedia.org/wiki/Buddy_Holly>
- Re: 16-bit wchar_t on Windows and Cygwin, (continued)
Re: bug#7948: 16-bit wchar_t on Windows and Cygwin, Paul Eggert, 2011/02/02
Re: 16-bit wchar_t on Windows and Cygwin, Eric Blake, 2011/02/02
Re: 16-bit wchar_t on Windows and Cygwin, Corinna Vinschen, 2011/02/02