Subject: strcmp() portability note

From: Pavel Curtis <[email-masked]>
Date: Tue, 27 Oct 1992 14:15:25 -0800

It has been brought to my attention that the MOO's built-in function strcmp()
returns different results on different systems.  For example, the expression

	strcmp("a", "f")

returns -5 on some systems but -1 on others.  Note that the specification of
strcmp() in the LambdaMOO Programmer's Manual says that only the sign of the
result is guaranteed to be meaningful, so this change across implementations is
not, technically, a bug.

On the other hand, when people write MOO code that assumes more about the
result of strcmp() (like that it returns the difference between the ASCII
values of the first pair of unequal characters in the two strings), that MOO
code is not portable to some other systems.

There are two solutions to this difficulty:

	-- change the server code to always return -1, 0, or 1.
	-- change the server code to always return the difference between the
	   ASCII values of the first pair of unequal characters in the two
	   strings.

Since it is possible to write efficient MOO code to do something like the
latter, using the index() built-in function and any desired character order
(including ASCII), and since such a result has nothing to do with string
comparison, I intend to adopt the first solution above in the next server
release.

Comments?

	Pavel