Boost logo

Boost :

Subject: Re: [boost] [Convert] std::isspace requires unsigned #28
From: Peter Dimov (lists_at_[hidden])
Date: 2017-03-20 11:13:10


Vladimir Batov wrote:
> On 2017-03-20 19:10, Olaf van der Spek via Boost wrote:
> >
> >> boost\convert\base.hpp(112): warning C6330: 'const char' passed as
> >> _Param_(1) when 'unsigned char' is required in call to 'isspace'.
> >
> >> boost\convert\base.hpp(115): warning C6330: 'const char' passed as
> >> _Param_(1) when 'unsigned char' is required in call to 'isspace'.
> >
> > https://github.com/boostorg/convert/issues/28
> >
> > IMO the code should be fixed and it's not a documentation issue.
> > What do you think?
>
> We discussed it on https://github.com/boostorg/convert/issues/28.

The analyzer is correct; passing char to isspace is a well-known bug, should
be cast to unsigned char. The accepted range of the argument to isspace
is -1..255 (assuming 8 bit character table), with -1 being EOF, and the
default promotion from char to int doesn't do the right thing when char is
signed.


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