Boost logo

Boost Users :

Subject: Re: [Boost-users] [proto] char vs. int behaviour when matching
From: Asif Lodhi (asif.lodhi_at_[hidden])
Date: 2009-09-02 23:38:27


On 9/3/09, Eric Niebler <eric_at_[hidden]> wrote:
> Maurizio Vitale wrote:
>> Proto behaves in a different way when matching terminal<char> and
>> terminal<int>.
>> The only difference I'm aware is that it is implementation defined
>> whether 'char' means 'signed char' or 'unsigned char' but it has to mean
>> one of the two.
>
> That's where you're mistaken. char, signed char and unsigned char are 3
> distinct types.

Yes. In "The C++ Programming Language, 3rd Ed.", Bjarne Stroustrup
says that sign of a "char" type is implementation defined. A "char"
type must behave identically to "signed char" or "unsigned char" but
the three char types are distinct, pointers to these distinct char
types can't be mixed, assigning too large a value to "signed char" is
undefined and advises to prefer plain "char" over signed char and
unsigned char to alleviate portability issues. (4.3, page 72 & 4.10
page 85).

Best regards,

-Asif


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net