Opened 11 years ago

Closed 11 years ago

#5746 closed Bugs (fixed)

Bugs in lexical_cast<unsigned_char> and <long long>

Reported by: John Maddock Owned by: Antony Polukhin
Milestone: Boost 1.48.0 Component: lexical_cast
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

The following expressions throw bad_lexical_cast exceptions, when I believe they should succeed just fine:

boost::lexical_cast<unsigned char>("128");
boost::lexical_cast<unsigned char>("64");

Conversion from smaller numbers such as "2" work just fine

Change History (3)

comment:1 by Antony Polukhin, 11 years ago

lexical_cast library works just like std::stringstream. Lexical conversion to char, signed char and unsigned char is simply reading a byte from source but since the source has more than one byte, the exception is thrown.

Such situations are described in FAQ, but not very obvious. I'll update the FAQ.

comment:2 by Antony Polukhin, 11 years ago

Milestone: To Be DeterminedBoost 1.48.0
Owner: changed from nasonov to Antony Polukhin
Status: newassigned

comment:3 by Antony Polukhin, 11 years ago

Resolution: fixed
Status: assignedclosed

(In [73705]) Fixes #5746 Updates FAQ section of documentation

Note: See TracTickets for help on using tickets.