This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)


On Mon, Nov 10, 1997 at 01:31:41PM -0500, Craig Burley wrote:
> >The functions take an int argument whose value is either representable
> >as an unsigned char, or is EOF.  gcc is warning when you pass a char,
> >since when char is sign extended to int it may take on values which
> >are not representable as an unsigned char.

Depending on the context, you may be able to state that the characters,
due to previous scanning, are all < 128, and so the warning can be ignored.

Off and on I get patches for modutils "fixing" the same problem in the
output of gprof, despite the fact that I know the string being tested
is a C symbol.

> However, I'll have to put this off at least until I can take
> enough time to figure out just how one is supposed to portably,
> efficiently, and standard-conformingly do things like
> `isalpha("foo"[0])' when the compiler encodes strings as `char *'.

isalpha and friends take an int and are guaranteed to work for both
signed and unsigned character input.  They also work for EOF which,
I believe, is not a member of any set.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]