X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f365fcbd591ef4da63f5ca44d1f4b22ab20d287..a25a17732c2d4d34d5d35a5318053dd8c6e29722:/docs/doxygen/overviews/unicode.h?ds=sidebyside diff --git a/docs/doxygen/overviews/unicode.h b/docs/doxygen/overviews/unicode.h index be0d550b9b..a84dc50aa1 100644 --- a/docs/doxygen/overviews/unicode.h +++ b/docs/doxygen/overviews/unicode.h @@ -372,19 +372,13 @@ const char *p = s.ToUTF8(); puts(p); // or call any other function taking const char * @endcode does @b not work because the temporary buffer returned by wxString::ToUTF8() is -destroyed and @c p is left pointing nowhere. To correct this you may use +destroyed and @c p is left pointing nowhere. To correct this you should use @code -wxCharBuffer p(s.ToUTF8()); +const wxScopedCharBuffer p(s.ToUTF8()); puts(p); @endcode -which does work but results in an unnecessary copy of string data in the build -configurations when wxString::ToUTF8() returns the pointer to internal string buffer. -If this inefficiency is important you may write -@code -const wxUTF8Buf p(s.ToUTF8()); -puts(p); -@endcode -where @c wxUTF8Buf is the type corresponding to the real return type of wxString::ToUTF8(). +which does work. + Similarly, wxWX2WCbuf can be used for the return type of wxString::wc_str(). But, once again, none of these cryptic types is really needed if you just pass the return value of any of the functions mentioned in this section to another