Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#333 closed Feature Requests (None)

incorrect conditions to #define DISABLE_WIDE_CHAR_SUPPORT

Reported by: seza Owned by: kevlin
Milestone: Component: lexical_cast
Version: None Severity:
Keywords: Cc:

Description

I think absence of BOOST_NO_INTRINSIC_WCHAR_T isn't a
requirement for DISABLE_WIDE_CHAR_SUPPORT definition.

Suggested fix:
//old code
#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

//new code
#if defined(BOOST_NO_STRINGSTREAM) || \
    defined(BOOST_NO_STD_WSTRING) || \
    defined(BOOST_NO_STD_LOCALE)
#define DISABLE_WIDE_CHAR_SUPPORT
#endif

Change History (3)

comment:1 by kevlin, 18 years ago

Status: assignedclosed
Logged In: YES 
user_id=32864

This is not a defect. Unless wchar_t is supported properly as 
an intrinsic type, it cannot be differentiated from the 
corresponding integer type, leading incorrectly to a numeric 
rather than a textual conversion.

comment:2 by seza, 18 years ago

Logged In: YES 
user_id=1134968

The following construction doesn't work in vc++ 7.1 now
without /Zc:wchar_t (Treat wchar_t as a built-in type):
int num = ...;
boost::lexical_cast<std::wstring>(num);

I agree with your argument but this statement should work in
this case IMHO.

comment:3 by kevlin, 18 years ago

Logged In: YES 
user_id=32864

The behaviour of a basic_string<wchar_t> will depend in turn 
on what wchar_t is. Having conversions for wstring supported 
when conversions for wchar_t is not a distinct type would be 
inconsistent and would rely on more than can be guaranteed 
about the interaction between a non-standard I/O stream 
and non-standard basic_string implementation.
Note: See TracTickets for help on using tickets.