J
jacob navia
What is the result of that?
I am reimplementing the C library, and I would like to know.
Now I have it to return zero. Is that correct?
The standard says:The strncmp function compares not more than n characters (characters
that follow a
null character are not compared) from the array pointed to by s1 to the
array pointed to
by s2.
Returns
The strncmp function returns an integer greater than, equal to, or less
than zero,
accordingly as the possibly null-terminated array pointed to by s1 is
greater than, equal
to, or less than the possibly null-terminated array pointed to by s2.
(7.21.4.4 page 328)The zero case is not mentioned.
The comparison of no characters is always equal... (What a nonsense
isn't it?). But I *have* to return something.
I am reimplementing the C library, and I would like to know.
Now I have it to return zero. Is that correct?
The standard says:The strncmp function compares not more than n characters (characters
that follow a
null character are not compared) from the array pointed to by s1 to the
array pointed to
by s2.
Returns
The strncmp function returns an integer greater than, equal to, or less
than zero,
accordingly as the possibly null-terminated array pointed to by s1 is
greater than, equal
to, or less than the possibly null-terminated array pointed to by s2.
(7.21.4.4 page 328)The zero case is not mentioned.
The comparison of no characters is always equal... (What a nonsense
isn't it?). But I *have* to return something.