Argh! Sorry, I should have been able to figure that out myself, given
the usual implementations. My brain doesn't seem so good at seeing
the possibility of negative array indexing -- too many years of sloppy
assumptions.
However what you and Alan said about simply casting to (unsigned char)
isn't sufficient, at least on some platforms (IRIX-6, IIRC), at least
not to keep the compiler happy.
Sadly I do get the least warnings from every platform when the cast is
only to (int). I wonder if the compiler can be taught to detect uses
where a parameter may have a value out of range even though the data
type it is declared as is wide enough. The only solution the compiler
can really believe though, I think, would be a double cast where the
value is narrowed sufficiently before being widened again for the call.