Public Domain NRO - READ_ME

mark at cbosgd.UUCP mark at cbosgd.UUCP
Sat Aug 20 09:52:58 AEST 1983


re:
	On unix, (tolower) always subtracts a constant value from the argument
	and returns that value.
People ought to be careful with words like "always", especially in conjunction
with vague terms like "unix".

In V7 and many of its descendents (e.g. 4BSD), tolower(c) reads
	#define tolower(c)	((c)-'A'+'a')
It barfs on things that aren't upper case letters.

In System III and many of its descendents, there is a macro _tolower
defined like this, and a FUNCTION tolower that essentially does
	if (isupper(c))
		return _tolower(c);
	else
		return c;

In my opinion, the USG behavior is the better of the two.  (You can
argue about whether tolower should be a macro or function if you want.)
However, it is not safe to assume that tolower does sanity checking.



More information about the Comp.lang.c mailing list