X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 2 Feb 2011 22:38:42 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com, bug-gnulib AT gnu DOT org Subject: Re: 16-bit wchar_t on Windows and Cygwin Message-ID: <20110202213842.GP2675@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com, bug-gnulib AT gnu DOT org Mail-Followup-To: cygwin AT cygwin DOT com, bug-gnulib AT gnu DOT org References: <201101310304 DOT 42975 DOT bruno AT clisp DOT org> <4D46EA2B DOT 1010307 AT redhat DOT com> <201102021229 DOT 04623 DOT bruno AT clisp DOT org> <4D49CB7C DOT 5040000 AT redhat DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4D49CB7C.5040000@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Feb 2 14:24, Eric Blake wrote: > [dropping coreutils at this point] > > On 02/02/2011 04:29 AM, Bruno Haible wrote: > > Good point. I agree then that overriding wchar_t should better not be > > done. > > > > Here's a new proposal: > > - Define a type 'wwchar_t' on all platforms, equivalent to uint32_t > > on Windows platforms and to 'wchar_t' otherwise. > > - Define functions 'mbrtowwc', 'iswwalpha', 'wwcwidth', and similar. > > Their definition will be a trivial redirection to 'mbrtowc', 'iswalpha', > > 'wcwidth' on most platforms, and a use of libunistring modules on > > Windows platforms. > > I like the idea of making a new type wrapper. > > Are you thinking of making a sane wrapping around either 4-byte wchar_t > or which maps to 2-byte wchar_t but sanely handles UTF-16 (which makes > it a thin wrapper on both Linux and Cygwin, but needing more work on > mingw), or are you thinking that it is always a 4-byte type (needing > lots more memory manipulation on cygwin to convert between 2- and 4-byte > representations when using cygwin's functions, or else reimplementing > everything from scratch by completely bypassing cygwin)? > > As to the name: I agree the opinion of others that xchar_t is easier to > type and easier to avoid typos of a missing 'w' than wwchar_t. On the > other hand, I can see wwprintf that takes wide-wchar_t values, but > gnulib already has xprintf as a counterpart to xmalloc (which calls > exit() if the printf fails for memory allocation or other non-I/O > related reasons), so we can't blindly use 'x' instead of 'ww' when > replacing existing 'w' in POSIX APIs. May I suggest a compromise? What about "xwchar_t"? It avoids the potential typo by accidentally dropping the second w. It still contains "wchar" which implies that it's a *wide* char type. And the x could be read as "extended". Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple