Johnny Billquist <bqt%update.uu.se@localhost> writes:
See CAVEATS in ctype(3).
Right. But is gcc really smart enough to understand at compile time if
something else than -1 is the negative value, and that toupper in fact
is more limited than what the signature says?
The *signature* of the function is int toupper(int). If you pass a
char to that, I can't see that there would ever be a warning about any
problems.
The signature is that it takes an int, but the specification is that if
the value of the int is other than EOF or something representable as
unsigned char (projecting to he implementation, meaning -1 is ok and
0..255 is ok), then you get UB.