On Jan 26, 2005, at 5:08 AM, Nicholas Clark wrote:
On Wed, Jan 26, 2005 at 09:19:26AM +0100, Reinhard Pagitsch wrote:Hello Steve,
Steve Hay wrote:
why is it that the following XS code outputs -25:
[code sniped]
On my system (Windows 2000) the output is -1, as expected.
What's it documented to be? stricmp() doesn't seem to be a standard function
in any standard implemented on Unix, but strcmp()'s return is stated only
to be "an integer greater than, equal to, or less than 0", not specifically
-1 or +1
strcasecmp() is the POSIX equivalent. neither stricmp() nor strcasecmp() is ANSI. the semantics for both follow strcmp() -- every program i've ever written that's portable to win32 #defines strcasecmp to stricmp as necessary.
i've never had an occasion to look beyond comparison with zero at the actual return value of any of these, and always assumed that the non-zero values were "arbitrary".
--
"Ears! They help us -- Ears! They help us hear th-- Ea--E--E--E--Ears!"
-- A Sesame Street singing toy, with Yvonne gleefully pressing
the button over and over and over and over and...