On 20.10.2010 07:15, [email protected] wrote:
> On Tue, Oct 19, 2010 at 06:36:08PM +0200, Malte S. Stretz wrote:
> > Hi folks,
>
> > I recently started to hack on the Apache HTTPD codebase and immediately
> > stumbled upon one of my personal code smells: The usage of strcmp and
> > friends and how strings are compared for equality.
>
> > I know it is hard to agree on which variant is best [...]
>
> Just a personal data point from a newcomer and mostly lurker: my
> preferences are, in that order:
>
> strcmp(...) == 0
>
> !strcmp(...)
>
> macro
And my personal first is
0 == strcmp(...)
because the "..." can be very long and then it's hard to see the "== 0"
at the end.
Agree that macros are worst in this case because they quite handily hide
the meaning of the expression.
-- Brane