Boost logo

Boost :

Subject: Re: [boost] Query for interest in including a shim class converting between char*, wchar_t, string, wstring
From: Yakov Galka (ybungalobill_at_[hidden])
Date: 2011-08-25 08:10:57


On Thu, Aug 25, 2011 at 12:11, Tan, Tom (Shanghai) <TTan_at_[hidden]> wrote:

> As a C++ programmer, often times there's a need to widen or narrow a
> string to match some 3rd APIs. After writing similar code again and
> again, I decided to have a wrapper to simplify this trivial but frequent
> work, hence the TR and TR2 class. Features include:
>

If something fails to compile, there must be a reason. Just shutting up the
compiler doesn't make your code correct. What you're doing is like
reinterpret_casting an int to float...

[...]
> - Many Boost libraries (e.g. Boost.Test) that output plain
> English (ASCII) message literals can be easily extended to support both
> wide-char version with this class.
>

They don't have to support wide-char. Many programmers are not interested in
any wide-char support at all. See
http://programmers.stackexchange.com/questions/102205/should-utf-16-be-considered-harmful

- The 2 classes do not involve any encoding/decoding.
>

 tr.hpp:

> * N.B. it doe not do any code conversion like: MBCS <--> UNICODE
>

This is just wrong. Your code is useless as it doesn't solve any real
problem. This is not going to be accepted to boost, especially since it
misguides programmers to write Unicode incorrect and *broken* code. Yes, you
may find this library useful, and, say, half of non-expert programmers will
find this library useful. The sad thing is that most of them just don't
understand what Unicode is or what's text at all.

Btw, you're not the first to propose some kind of tools for 'Unicode
support'. I can count at least 4 other proposals trying to solve different
aspects by different means. None of them was accepted to boost yet.

-- 
Yakov

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk