Subject: Re: CVS commit: src/lib
To: <>
From: David Laight <david@l8s.co.uk>
List: source-changes
Date: 10/27/2004 21:36:17
> >Fix a load of international alphabet problems with isxxx() and toupper()
> >Change isspace(*char_ptr) to isspace(*char_ptr & 0xff) so that the correct
> >piece of memory is looked at for the bit mask.
> >gcc optimises out the '& 0xff' (on i386 at least).
> >Fixes problems found by gcc when the splurious (int) cast is removed
> 
> Why didn't you cast to (unsigned char) as is the current practice everywhere
> else in the code?!?

Because I want the compiler to check that the argument is an integral value.
In particular isdigit((unsigned char)cp) is a likely typo...

I did check that the i386 generated code is a movzb.
So *cp & 0xff, *(unsigned char *)cp, and (unsigned char)*cp probably all
generate the same object code undeg gcc.

	David

-- 
David Laight: david@l8s.co.uk