www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_WW,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4D49CB7C.5040000@redhat.com> |
Date: | Wed, 02 Feb 2011 14:24:12 -0700 |
From: | Eric Blake <eblake AT redhat DOT com> |
User-Agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com, bug-gnulib <bug-gnulib AT gnu DOT org> |
Subject: | Re: 16-bit wchar_t on Windows and Cygwin |
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> |
In-Reply-To: | <201102021229.04623.bruno@clisp.org> |
OpenPGP: | url=http://people.redhat.com/eblake/eblake.gpg |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
--------------enigAD3F75B045DE77A399831D51 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable [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. >=20 > 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', 'iswalph= a', > '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. --=20 Eric Blake eblake AT redhat DOT com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigAD3F75B045DE77A399831D51 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNSct8AAoJEKeha0olJ0NqgAIIAJaFLfBVMU2RT77Xc1KSE4ad rwkhh/IYgxK0u/kWVlGLiM/K4Nvojwr4iWcGk3FyMepLMzBSjh2LiRDS4hIbPAQc bCF+6i2lKlarN9s4prW4dyTCyR6RDlVV4CyzQ73KxfGKjR/Xbld5FPPPutT90fjj R1yfTs89ney0664s10U3IVoNqXh2cCHR3Mt4iZC+b2w9+H5HqseXmlMOhGD1U+yM DcL2XZvV27pNzoRWqSdkyV7Bh/XLbYutnWETDLZvSGpCp275pQABY0czWGiOnGnC zLkIVn0RxvxLPOSArHEcgcYlXYTIelg9BXy7/gnc6tNhxWtoADxTKxW9iT9JxP4= =3EPn -----END PGP SIGNATURE----- --------------enigAD3F75B045DE77A399831D51--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |