Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/lib



> >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@localhost



Home | Main Index | Thread Index | Old Index