tech-userlevel archive

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

Re: Suggested change of ctype.h

In article <>,
Juergen Buchmueller  <> wrote:
>several times I stumbled over gcc's warnings regarding the use of a
>signed character as index in the ctype.h functions. And indeed, when you
>look at the results of e.g. toupper(-128) to toupper(-1) they are
>'interesting' to say the least. You get some code from the memory
>before the array. The values are not quite random, but very wrong.
>Other OSes return the original value for {toupper|tolower}(char<0) and
>to me it seems to make sense to clean up this little annoyance.

We have discussed this numerous times in the past and the consensus
is that passing negative values other than -1 is undefined behavior
according to TOG, and defining undefined behavior makes code that
uses our libraries less portable. Fix the code, don't sandbag the


Home | Main Index | Thread Index | Old Index