Boost logo

Boost :

Subject: Re: [boost] [Convert] std::isspace requires unsigned #28
From: Olaf van der Spek (ml_at_[hidden])
Date: 2017-03-20 20:29:13


On Mon, Mar 20, 2017 at 9:07 PM, Vladimir Batov via Boost
<boost_at_[hidden]> wrote:
> On 2017-03-20 22:13, Peter Dimov via Boost wrote:
>>
>> Vladimir Batov wrote:
>>>
>>> ...
>>> 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.
>
>
> Thanks, Peter, for clarifications. Clearly, the analyzer is correct. My
> interpretation was that it was the documented isspace() behavior. So, I felt
> somewhat uncomfortable "correcting"/changing the documented behavior. Now
> that you mention that it is a well-known bug to be (unfortunately) addressed
> I did just that. Thanks again. Much appreciated.

That's quite a lot of changes for a simple 'bug fix'. ;)

https://github.com/boostorg/convert/commit/1b66bd64085d66ff4d8e1cba520e025ff9651fa5

-- 
Olaf

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