29 May 2012 06:41
Re: [nowide] Easy Unicode For Windows: Request For Comments/Preliminary Review
Artyom Beilis <artyomtnk <at> yahoo.com>
2012-05-29 04:41:38 GMT
2012-05-29 04:41:38 GMT
>________________________________ > From: Yakov Galka <ybungalobill <at> gmail.com> >On Mon, May 28, 2012 at 3:33 PM, Artyom Beilis <artyomtnk <at> yahoo.com> wrote: > >> [...] >> The library provides an implementation of standard C and C++ library >> functions such that their inputs are UTF-8 aware on Windows without >> requiring using Wide API to make program work on Windows. >> > >Hi, > >I'm happy that this is getting to be proposed to boost. > Also note, it is different from the old version of my nowide library I published once: added argv, argc, env and cin/cout/cerr/log such that you can actually write and read Unicode characters to/from console... >My comments: > >* I find the way you handle the main() arguments elegant. > >* I don't like that the convert function is overloaded for both narrow and >wide conversions. >Rationale: Consider the following real-world scenario: > > // Some existing overloaded function, like std::fstream constructor on >dinkumware > void f(const std::string &s); // 3rd party 'ANSI' codepage > void f(const std::wstring &s); // 3rd party 'UNICODE' > > std::string str = get_utf8_string(); > f(convert(str)); // we want to call the wide string version > >Now during development we may change it to: > > std::wstring str = get_string_from_windows(); // we changed only this >line > f(convert(str)); // and forgot to change this one. oops... > >Solution: This is an error that can be caught at compile time, we just have >to state the intent clearly. Use alternative names? (narrow/widen) Very good point. I'll change them to widen/narrower > > >Cheers, >-- >Yakov > Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
RSS Feed