Comparing strings... (long but maybe worth it)

Andrew Koenig ark at alice.att.com
Mon Oct 15 00:26:17 AEST 1990


In article <1990Oct14.095336.2819 at zoo.toronto.edu>, henry at zoo.toronto.edu (Henry Spencer) writes:

> Some (for example, me) would say that this was aided by your reliance on
> implicit comparisons to zero, which hurt readability and do nothing for
> your stated goal of greater efficiency.  Why did you bother doing that?

Because for me it increases readability.

> >I imagine that further optimizations are possible...

> Definitely. ...
> [optimization description deleted]

Neat!  And you haven't even unrolled any loops!

> For extra credit, discuss how current implementations by
> both Berkeley and AT&T attempt this optimization and thereby introduce
> a bug (hint:  consider the fact that char is signed on most machines).

I'm afraid I may have given it away in another posting, which I made
before I saw this one.
-- 
				--Andrew Koenig
				  ark at europa.att.com



More information about the Comp.lang.c mailing list