egcs/fortran warnings (Was : possible spurious warning for isdigit)
Ian Lance Taylor
ian@cygnus.com
Mon Nov 10 13:47:00 GMT 1997
Date: Mon, 10 Nov 1997 13:31:41 -0500 (EST)
From: Craig Burley <burley@gnu.org>
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 *'.
Either
isalpha ((unsigned char) ("foo"[0]))
or
isalpha (((const unsigned char *) "foo")[0])
That is, generally, I'm not sure offhand how to properly use
these functions when the character has already been read
via, say, getc(), validated as not being EOF, and copied into
an element of a `char *'. Simply casting the `char' back to
`int' is plainly wrong, but maybe casting it to `unsigned char'
isn't?
Right; just cast to unsigned char. Some very very old compilers don't
support unsigned char, but that is presumably not a problem for the
code in question. (For those compilers, you can safely `& 0xff').
Ian
More information about the Gcc
mailing list