This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
- To: burley at gnu dot org
- Subject: Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
- From: Ian Lance Taylor <ian at cygnus dot com>
- Date: Mon, 10 Nov 1997 13:35:07 -0500
- CC: phdm at mail dot macqel dot be, eisenbud at cs dot swarthmore dot edu, egcs at cygnus dot com
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