tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: once again, some discussion about <ctype.h> interfaces....

> [...] -- I'm getting far too many unnecessary warnings on legacy code
> that should not have to be modified (i.e. code that is passing
> 'char', never 'int', and thus never EOF).

With very few exceptions, such code is not correct and should be fixed.
The domain of the ctype.h macros is "values attainable by unsigned
char, plus EOF".  Plain char is suitable only on "char is unsigned"
architectures; unless the code is not intended to be portable to "char
is signed" architectures, or unless the arguments are somehow ensured
to be in the [0..CHAR_MAX] range, it is incorrect to pass plain char to
the ctype.h macros.

While what NetBSD chooses in this respect doesn't matter to me
personally, I prefer to get some kind of warning when passing a plain
char to ctype.h calls.  I am not convinced it is doing anyone any
favours to suppress the warnings.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML      
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Home | Main Index | Thread Index | Old Index