Boost logo

Boost :

Subject: Re: [boost] [lexical_cast] cast of int8_t
From: Lars Viklund (zao_at_[hidden])
Date: 2012-10-13 17:43:38


On Sat, Oct 13, 2012 at 11:14:30PM +0200, Olaf van der Spek wrote:
> On Sat, Oct 13, 2012 at 10:35 PM, Jochen Wilhelmy
> <jochen.wilhelmy_at_[hidden]> wrote:
> > 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.
>
> I might be wrong, but aren't there only two types, signed char and
> unsigned char, with unqualified char being equivalent to one of them
> (depending on platform)?

They are three distinct types. The signedness (and thus the range of
values it can take on) of plain char is the same as one of the
unsigned/signed char, but it's still a distinct type, see C++11 3.9.1/1.

-- 
Lars Viklund | zao_at_[hidden]

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