egcs, casting the argument of eg isalpha to an int...
Manfred.Hollstein@ks.sel.alcatel.de
Manfred.Hollstein@ks.sel.alcatel.de
Mon Feb 16 03:18:00 GMT 1998
On Sun, 15 February 1998, 22:08:04, ghazi@caip.rutgers.edu wrote:
> > From: Manfred Hollstein <manfred@s-direktnet.de>
> >
> > > I'm thinking of changing them to this:
> > >
> > > > #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (((int)(c))))
> > >
> > > This would seem to avoid the warning.
> > >
> > > Is this solution correct from a technical standpoint?
> > >
> >
> > This yields wrong results for e.g. bloody german umlauts with the
> > high bit set:
> >
> >
> > the following cast sequence would be better:
> >
> > my_isalpha ((int) ((unsigned char) 'A'));
> > my_isalpha ((int) ((unsigned char) 'ä'));
> >
> > Manfred
>
> I think you may be right except for the isascii function which
> is supposed to work for all int values. The rest are valid only for
> an int whose value is representable in an unsigned char.
>
> So perhaps isascii's argument gets cast to int, the rest get
> cast to unsigned char?
Ooops, didn't thought of that. I guess this way is the wright one.
Manfred
More information about the Gcc
mailing list