This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Return values of strcmp
- From: Arnaud GRANAL <serphen at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Thu, 14 May 2009 17:30:47 +0200
- Subject: Return values of strcmp
Hello,
I am writing a tiny implementation of glibc in asm x86 and I have a
question about return values of strcmp.
FreeBSD manpages tells us this:
RETURN VALUES
The strcmp() and strncmp() return an integer greater than, equal to, or
less than 0, according as the string s1 is greater than, equal to, or
less than the string s2.
My implementation returns, -1, 0 or 1.
My question is simple: Is this an acceptable solution ?
P.S.: It technically works (Firefox, xeyes, etc...) but I am wondering
if it corresponds to what strcmp has been originally created for.
Thank you,
--
Arnaud Granal