XENIX 3.0 toupper() and tolower() broken
Henry Spencer
henry at utzoo.UUCP
Wed Oct 2 04:09:28 AEST 1985
> This is not the only bug running around in toupper/tolower. While
> some systems have this implementation, other versions (among which
> is the Fortune) do not do any sanity check, they just add/subtract
> 0x20, thus transforming numerals into control codes or letters,
> depending on the direction of conversion...
This was the original definition of toupper/tolower. It was not a bug;
the domain of legal arguments was letters of the opposite case, period.
This way if you knew the nature of the argument, the overhead of the
check was unnecessary; if you didn't, you were supposed to do the check
first. So many people were sloppy about it that inadequate domain
checking became a characteristic error when using these macros. So the
definition was eventually changed. Implementations that don't check are
not buggy: they are conforming correctly to an earlier, and arguably less
desirable (certainly less idiot-proof), version of the specs.
--
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!henry
More information about the Net.bugs
mailing list