← Back to team overview

kicad-developers team mailing list archive

Re: Re: wxString.c_str()


2009/10/12 Dick Hollenbeck <dick@...>:
> Wayne Stambaugh wrote:
>> emmedics4 wrote:
>>> --- In kicad-devel@xxxxxxxxxxxxxxx, Wayne Stambaugh <stambaughw@...>
>>>> Has anyone tried using the (const wxChar *) cast operator?  I've been
>>>> using it in Printf and the logging function calls and it appears to work
>>>> fine.  It is just a typedef for wxString::const_pointer but it returns
>>>> the correct character type depending on the character set used in
>>>> wxWidgets.  I like it because it is reasonably descriptive and it
>>>> appears to work with most versions of wxWidgets.  Using the example
>>>> above, it is used as follows:
>>>> s.Printf( wxT( "%s" ), (const wxChar*) formatMe );
>>>> It also works with the gettext _() macro.
>>> Indeed but wxChar is going to be wiped in new versions, i think Dick was talking taking in consideration a more long term approach: changing code style to enhance code longevity and issues tomorrow.
>>> Please take a look to:
>>> http://docs.wxwidgets.org/trunk/overview_unicode.html#overview_unicode_pitfalls
>>> http://docs.wxwidgets.org/trunk/classwx_string.html#conv
>> Thanks for the info.  Looks like we'll have to support the differences
>> between 3.X and 2.8.x strings for the foreseeable future.
> All the upcoming differences are well hidden in the new APIs except one,
> the one I identified:  wxString::Printf()
> And the best way of future-proofing the usage of wxString::Printf() is
> to use GetChars().
> I hope this email settles the issue.
> Dick

I only tag this onto the end of this conversation because it is
probably relevant, but SVN 2011 barfs on my PC whilst building with
the error:

[ 65%] Building CXX object common/CMakeFiles/common.dir/basicframe.cpp.obj
c:/MinGW/src/kicad/common/basicframe.cpp: In member function `void
c:/MinGW/src/kicad/common/basicframe.cpp:271: error: `GetChars' was
not declared in this scope
c:/MinGW/src/kicad/common/basicframe.cpp:271: warning: unused variable
make[2]: *** [common/CMakeFiles/common.dir/basicframe.cpp.obj] Error 1
make[1]: *** [common/CMakeFiles/common.dir/all] Error 2
make: *** [all] Error 2

SVN 2010 did not have this problem.

Best Regards,

Brian Sidebotham.

Follow ups