Boost logo

Boost :

Subject: [boost] [lexical_cast] cast of int8_t
From: Jochen Wilhelmy (jochen.wilhelmy_at_[hidden])
Date: 2012-10-13 16:35:48


Hi!
In a previous message I asked if lexical_cast could throw
boost::numeric::positive_overflow when the parsing is ok but the value
too large for the target type. this turned out to be difficult because
it breaks existing code, alternatively there could be another exception
derived from bad_lexical_cast that indicates the overflow but this seems
to be a lot of work.

another question is why does lexical_cast treat int8_t and uint8_t like
char? technically I see no reason for this as c++ has three types: char,
signed char and unsigned char. in my code I use only char for characters
and signed/unsigned char as numbers. I know that the standard stream
operator << treats signed/unsigned char as char but I know no
explanation for this (I consider it a bug ;-)

-Jochen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk