|
Boost Users : |
From: Black Ice (yg-boost-users_at_[hidden])
Date: 2003-03-30 22:50:23
Thanks
-- /*******************/ ×ÔÓÉ£¨liberty£©Î޷ǾÍÊÇÕâÑùÒ»ÖÖ³Ðŵ£ºÃ¿¸öÈ˽«»áµÃµ½Ò»ÖÖ±£ÕÏ£¬±£ÕÏÎÒÃÇ¿ÉÒÔÓë ȨÍþ¡¢¶àÊý¡¢Á÷Ë×¼°ÓßÂÛµÄÓ°ÏìÏ࿹ºâ¡£ /*******************/ "Terje Sletteb?" <tslettebo_at_[hidden]> wrote in message news:03d401c2f596$be6d2a40$8d6c6f50_at_pc... > >From: "Black Ice" <yg-boost-users_at_[hidden]> > > > When lexical_cast used under VC, and the option "Treat wchar_t as Build-in > > Type" is off > > The following code will cause compile error: > > int main(int argc, char * argv[]) > > { > > string str("10"); > > unsigned short n = lexical_cast<unsigned short>(str); > > return 0; > > } > > > > Because in lexical_cast::detail::widest_char, treat unsigned short as > > wchar_t!! > > I have tested it, and can confirm this problem. The problem is that > lexical_cast doesn't disable wide character support in this case. It seems > it needs to test for BOOST_NO_INTRINSIC_WCHAR_T, after all, as it did > earlier. In other words, change this: > > #if defined(BOOST_NO_STRINGSTREAM) || \ > defined(BOOST_NO_STD_WSTRING) || \ > defined(BOOST_NO_STD_LOCALE) || \ > defined(BOOST_NO_CWCHAR) || \ > defined(BOOST_MSVC) && (BOOST_MSVC <= 1200) > #define DISABLE_WIDE_CHAR_SUPPORT > #endif > > to this: > > #if defined(BOOST_NO_STRINGSTREAM) || \ > defined(BOOST_NO_STD_WSTRING) || \ > defined(BOOST_NO_STD_LOCALE) || \ > defined(BOOST_NO_INTRINSIC_WCHAR_T) > #define DISABLE_WIDE_CHAR_SUPPORT > #endif > > and remove this: > > #ifdef BOOST_NO_INTRINSIC_WCHAR_T > #include <cwchar> > #endif > > If this is done, it works, both for the option on or off. > > This also disables wide character support on Intel C++, even though it > handles it, as it doesn't set _NATIVE_WCHAR_T_DEFINED, even when intrinsic > wchar_t is turned on. However, this is really an issue in the detection on > Intel C++, rather than with lexical_cast. > > > Regards, > > Terje > > > > Info: <http://www.boost.org> > Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> > Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]> > > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ > > >
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net