kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #03317
wxString.c_str()
-
To:
kicad-devel@xxxxxxxxxxxxxxx
-
From:
Dick Hollenbeck <dick@...>
-
Date:
Sun, 11 Oct 2009 15:30:41 -0500
-
Scanners:
none
-
User-agent:
Thunderbird 2.0.0.23 (X11/20090817)
Jean-Pierre & Other Developers,
It is my understanding that on newer versions of wxWidgets, we will not
be able to pass wxString.c_str() to the Printf() function of wxString.
And wxString.GetData() will not exist.
http://docs.wxwidgets.org/stable/wx_wxstring.html#wxstringcstr
I first discovered this when using wxWidgets 2.9, and this is why I
wrote the GetChars( wxString ) function to hide this future migration
problem.
Please let me know if I am wrong, otherwise please consider minimizing
our pain in the future and look into our macros.h's GetChars() please.
(I do like the wxString.Printf() function. And this is no reason to
stop using that.)
So according to my understanding, we are better writing:
wxString s;
wxString formatMe;
s.Printf( wxT("%s"), GetChars( formatMe ) );
than this:
s.Printf( wxT("%s"), formatMe.c_str() );
For 2.9 or 3.0 the c_str() will not work, at least that is my
understanding based on a snapshot 5 months ago when I wrote GetChars().
Tootles,
Dick
Follow ups