Re: [PATCH] SBuf c-string comparisons

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Fri, 18 Apr 2014 15:04:20 -0600

On 04/18/2014 12:12 PM, Amos Jeffries wrote:

> I see you are suggesting the FreeBSD libc strncmp() method
> http://fxr.watson.org/fxr/source/string/strncmp.c?v=FREEBSD6-LIBC

I have not seen that FreeBSD code before, and I do not think my sketch
is similar to it.

IIRC, my sketch is similar to the glibc(?) code you pasted earlier,
without the optimization part. It is simple/straightforward: get current
characters, increment position, compare, quit if done. Easy to grok,
with little room for error, and no need for exceptional checks before
and after. The only complexity there is that the if-statement inside the
loop covers !c2 implicitly (a documented optimization).

I do not understand why you prefer exceptional checks before, complex
loop in the middle, and exceptional checks after, but my understanding
of your preferences is not the acceptance criteria.

> If you are okay with the new bits marked (EXHIBIT A) and (EXHIBIT B) I
> think we are done. These have already been checked against all unit
> tests and passed.

Please repost the current code/patch. Since most bugs were in the
dependencies between different code parts, I do not think it is a good
idea to review isolated EXHIBITs. We already know that you have not
decreased the code complexity, so I am not going to _like_ what I see,
but that is not the acceptance criteria either.

Thank you,

Alex.
Received on Fri Apr 18 2014 - 21:04:36 MDT

This archive was generated by hypermail 2.2.0 : Sun Apr 20 2014 - 12:00:14 MDT