httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Poirier <>
Subject Re: [PATCH] How to Use strcmp to Check for Equality Without Confusing Your Fellow Code, Or: Isn't There a Macro for That?
Date Tue, 19 Oct 2010 19:28:50 GMT
On 2010-10-19 at 15:21, "Roy T. Fielding" <> wrote:

> On Oct 19, 2010, at 9:36 AM, Malte S. Stretz wrote:
>> And there are a lot of string compares in the Apache codebase.  Everytime 
>> you see a strcmp, you (or is it only me?) have to stop and think "well, is 
>> this branch checking for equality or the opposite?"
>> I think this is a case where either a coding standard could help, or some 
>> helper macros in APR.  I went for the latter and defined APR_EQ plus 
>> variants in apr_string.h.  See attached patch.
> Maybe a standard would help.  More macros would not -- that pain would be
> far worse than the current inconsistency.  -1 (design opinion, not veto)

I tend to agree with that.  Writing our code in C in a consistent way
that will become very familiar to Apache developers and is easy to
interpret by anyone else who's already familiar with C is better than
trying to use macros to hide it, and thus making it unfamiliar to

Is there a commonly accepted usual way of writing this that we
could adopt without getting into a long discussion of the relative
merits of every possibility?


View raw message