Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: How to get standard paths?!? Date: Sat, 17 Aug 2019 11:22:55 -0700 Organization: A noiseless patient Spider Lines: 31 Message-ID: <86blwnd534.fsf@mailhub.linuxsc.com> References: <_ZR5F.12655$hJ3.11614@fx07.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="29668c8b09377538a8d07c3ead24e537"; logging-data="5837"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HO/1B5o8l7K9ukQVV1kytdgSHSL7hc/U=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:xS4H6OgRCPLip1rnQ939wSnODhI= sha1:fIn4WpYQkzwB5ifvdU7ChnIOlZU= Xref: csiph.com comp.lang.c++:67711 Bonita Montero writes: >>>> Be advised that in Windows wide strings are UTF-16 encoded. >>> >>> And I think that it would be the best to use std::u16string >>> because wchar_t is not absolutely guaranteed to be 16 bit >>> wide. >> >> It is guaranteed /not/ to be 16-bit on most systems. > > You can be pretty sure that by far most implementations specify > whcar_t as 16 bit since it makes no sense to implement it differently. > But it's easier to conform to any hypothetical implementation by using > char16_t. (and in another posting quotes the C++ standard) > "Type wchar_t is a distinct type whose values can represent distinct > codes for all members of the largest extended character set specified > among the supported locales (22.3.1)." Like you say, the C and C++ standards require wchar_t to be large enough so one wchar_t object can hold distinct values for every character in the largest supported character set. Most widely used operating systems today (eg, Microsoft Windows, Linux) support character sets with (at least) hundreds of thousands of characters. Can you explain how hundreds of thousands distinct values can be represented in a single 16-bit wide wchar_t object?