On Thu, 19 Dec 2019 15:50:07 +0000
"Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin-patches" wrote:
> Just noticed that in the patch below and couldn't help it, sorry..
> 
> Things like
> 
> char* p0;
> 
> and later:
> 
> isdigit(*p0))  or  isalpha(*p0)
> 
> are usually not a good (correct) way of coding, because of possible sign 
> extension of *p0
> which you normally wouldn't want to have (remember the ctype calls/macros 
> actually expect
> an "int", not a character, input).  So it should be either "unsigned char* 
> p0" or
> "isdigit((unsigned char)(*p0))", generally.

Thanks for the advice. In general, you are right.

However, in cygwin, ALLOW_NEGATIVE_CTYPE_INDEX is defined
in ctype library in newlib, and the lookup table is extended
in the negative direction.

So, in terms of results, the code works as expected. 

-- 
Takashi Yano <takashi.y...@nifty.ne.jp>

Reply via email to