[wx-dev] wxColour strings

Vadim Zeitlin vadim at wxwindows.org
Fri Jun 1 05:24:18 PDT 2007


On Wed, 30 May 2007 14:11:52 +0200 Vaclav Slavik <vslavik at fastmail.fm> wrote:

VS> See the commit message, code like this doesn't compile after I removed 
VS> them:
VS> 
VS>    wxPen mypen("blue",1,wxSOLID);
VS> 
VS> The error given by gcc is:
VS> 
VS>    invalid conversion from ‘const wchar_t*’ to ‘long unsigned int’
VS>    initializing argument 1 of ‘wxColour::wxColour(long unsigned int)’
VS> 
VS> The compiler has to create temporary wxColour instance to pass to 
VS> wxPen ctor and another temporary wxString in order to be able to call 
VS> wxColour(wxString) ctor.  Apparently that's too much to ask from a 
VS> C++ compiler.

 Yes, because a C++ compiler is not supposed to apply more than one
user-defined conversion implicitly. However the code like above is very
common and it's really bad news that it doesn't compile any longer. I'm
afraid we'll have to provide wxColour ctor overload taking "const char *"
too.

 TIA,
VZ





More information about the wx-dev mailing list