[wx-dev] Re: Improving wxString proposal (Re: #9672: wx 2.9
Ansi/Unicode Combi-wxString)
Hajo Kirchhoff
mailinglists at hajo-kirchhoff.de
Fri Jul 11 02:10:03 PDT 2008
Hi Vadim and Vaclav,
[wxString string=wxUString()]
[assigning unicode string to a char string]
> And the latter does *not* work, it results in silent data loss. Please
> don't gloss over this as if it were an inconsequential detail, this is a
> huge problem totally overshadowing any performance gain and ease
Here is one thing I don't understand: You harshly criticise me of
"glossing over" this huge problem. At the same time you allow
<quote_wiki>
wxString will also be implicitly convertible to both const char * and
const wchar_t *.
</quote>
How does the present 2.9 solution avoid silent and potentially
catastrophic data loss in the same case?
void external_function(const char *some_string);
void call_external()
{
wxString data;
external_function(data);
}
This will compile without any warning in 2.9, even though a unicode
string is implicitly converted to a char* string, possibly loosing data.
I don't understand how the present wx2.9 wxString implementation avoids
this problem, if you allow implicit wxUniChar/wxString conversion
to char or const char*.
What am I missing here?
Regards
Hajo
More information about the wx-dev
mailing list