[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: CVS update: MODIFIED: libsvn_ra_dav ...

From: <kfogel_at_collab.net>
Date: 2001-08-14 20:46:18 CEST

Joe Orton <joe@manyfish.co.uk> writes:
> Are you thinking strncmp compares exactly 4 bytes? It compares *at most*
> 4 bytes, and still terminates on a \0 before that...

Yeah, I was thinking the former.

Now, I want it on the record that this possibility *did* occur to me
before I wrote Greg :-) ... So I went and looked it up. The combined
manual entry for strcmp() and strncmp() on my system says:

   The strcmp() function compares the two strings s1 and s2.
   It returns an integer less than, equal to, or greater than
   zero if s1 is found, respectively, to be less than, to
   match, or be greater than s2.
   
   The strncmp() function is similar, except it only compares
   the first n characters of s1.

Which is at best ambiguous. I just went and looked it up in K&R.
They get it right, by inserting an "at most" before "the first".

Thanks for the reminder, Joe!

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:36 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.