Re: [Boost-bugs] [Boost C++ Libraries] #287: wrong usage of ios_base::narrow

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #287: wrong usage of ios_base::narrow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-06-01 09:14:35


#287: wrong usage of ios_base::narrow
---------------------------+------------------------------------------------
  Reporter: vandrejev | Owner: az_sw_dude
      Type: Bugs | Status: assigned
 Milestone: Boost 1.40.0 | Component: date_time
   Version: None | Severity: Problem
Resolution: None | Keywords:
---------------------------+------------------------------------------------

Comment(by andysem):

 Replying to [comment:4 steven_watanabe]:
> At least the call to narrow should be removed to avoid giving the false
 impression that it's safe.

 I think this would be more appropriate:

 {{{
 char c = 'X'; // 'X' will cause exception to be thrown
 const wchar_t wc = *beg++;
 if (wc >= 0 && wc <= 127)
   c = static_cast< char >(wc);
 ss << c;
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/287#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC