httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: cvs commit: httpd-2.0/server/mpm/prefork prefork.c
Date Mon, 08 Jan 2001 23:36:19 GMT
Greg Stein wrote:
> 
> On Mon, Jan 08, 2001 at 08:01:35AM -0500, Jeff Trawick wrote:
> > rbb@covalent.net writes:
> >...
> > > Can we change the strcmp to a memcmp, since we know that these are static
> > > strings?
> >
> > Is there a compiler which is known to generate worse code for strcmp()
> > than for memcmp() in this case?
> 
> It isn't so much the compiler, as just the actual semantics of the two
> functions. strcmp() copies until it reaches a null-term, which means it must
> be checking the bytes for a null-term. memcmp() just copies regardless.

I just said the same thing, but it seems not to have arrived yet.
Anyway, mere moments after hitting the send button I realised this ain't
true if one of the arguments is a fixed string - then you (and the
compiler) can use memcmp instead. Whether this means the code will be
the same for strcmp depends on whether memcmp is actually better than
strcmp.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Mime
View raw message