Re: [pcre-dev] bugs in PCRE

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: Craig Silverstein
CC: seppi, pcre-dev
Subject: Re: [pcre-dev] bugs in PCRE
On Sat, 8 Mar 2008, Craig Silverstein wrote:

> This isn't C++ actually; it's the normal C isspace() etc. I don't
> understand what you mean about these functions "requiring" an unsigned
> char. As you note, their signature takes an int. Passing a signed
> char to these functions is just fine: any number that would be
> interpreted as negative (that is, ascii >= 128) will have isspace()
> and isdigit() return false, which is what we want.


Thinking about it, I suspect the reason they are defined with int
arguments is so that a char argument (which is what they are commonly
called with) is OK in both "char-is-signed" and "char-is-unsigned"
environments. [Personally, I believe the decision not to force char to
be one or the other in the original C standard has caused more trouble
than it has saved, but that's another story.]

> That said, there's no harm explicitly casting to an unsigned number.
> But I don't believe it's necessary for correctness.


I agree. I won't do anything unless you tell me to.

Philip

--
Philip Hazel