Am Mittwoch, 13. September 2006 18:24 schrieb Enrico Forestieri: > I have installed STLport and the above program still says "size: 2", so > I think that it "has to be" that way on windows.
Well, the STL can't change the size of builtin types, so that is expected. wchar_t does not "have to be" 2 byte wide on windows, but it is what native windows compilers usually do. On cygwin you have to make a choice whether to follow other windows compilers or unix. I would not be surprised if the opposite switch to -fshort-wchar would exist on cygwin. > As regards the usable char_traits and friends, if you can provide me > a test program I can try compiling it using STLport and report back > the results. Try this one. On linux the output is: global has std::codecvt<boost::uint32_t> facet: 0 global has std::ctype<boost::uint32_t> facet: 0 global has std::num_put<boost::uint32_t> facet: 0 terminate called after throwing an instance of 'std::bad_cast' what(): St8bad_cast Abgebrochen Georg
#include <boost/cstdint.hpp> #include <iostream> #include <locale> #include <sstream> int main() { std::locale const global; std::cerr << "global has std::codecvt<boost::uint32_t> facet: " << std::has_facet<std::codecvt<boost::uint32_t, char, std::mbstate_t> >(global) << std::endl; std::cerr << "global has std::ctype<boost::uint32_t> facet: " << std::has_facet<std::ctype<boost::uint32_t> >(global) << std::endl; std::cerr << "global has std::num_put<boost::uint32_t> facet: " << std::has_facet<std::ctype<boost::uint32_t> >(global) << std::endl; std::basic_ostringstream<boost::uint32_t> os; os << 'x' << 11 << ' ' << 3.0; std::basic_string<boost::uint32_t> const s(os.str()); std::cerr << "stringstream test: "; for (size_t i = 0; i < s.size(); ++i) std::cerr << s[i]; std::cerr << '\n'; return 0; }