]> git.saurik.com Git - wxWidgets.git/commitdiff
Explicitly mention MSVC std::fstream(wxString) incompatibility issue.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 30 Dec 2009 13:38:06 +0000 (13:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 30 Dec 2009 13:38:06 +0000 (13:38 +0000)
The fact that std::fstream provides a non-standard constructor in MSVC CRT
implementation is sufficiently confusing to merit a special mention.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63016 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/doxygen/overviews/changes_since28.h

index f7dc4dffb25fa28689f5f8e72a70a03d606918a6..a84431a08fee0d025b0bf8e6ec2d19b21ca9b9ca 100644 (file)
@@ -61,6 +61,24 @@ to use, e.g.:
     OpenLogFile(s.mb_str());    // OK: always calls narrow string overload
     OpenLogFile(s.wc_str());    // OK: always calls wide string overload
 @endcode
+A common example of such problem arises with @c std::fstream class constructor
+in Microsoft Visual C++ standard library implementation. In addition to a
+constructor from @c const @c char * which this class must have, it also
+provides a constructor taking a wide character file name. Because of this, code
+like the following
+@code
+    #include <fstream>
+
+    void MyFunc(const wxString& filename)
+    {
+        std::ifstream ifs(filename.c_str());
+        ...
+    }
+@endcode
+does not compile when using Microsoft Visual C++ and needs to be changed to use
+mb_str() (which will not work for file names containing Unicode characters,
+consider using wxWidgets classes and functions to work with such file names as
+they are not supported by standard C++ library).
 
 The other class of incompatible changes is due to modifying some virtual
 methods to use @c wxString parameters instead of @c const @c wxChar* ones to