Dammit, guess I shouldn't have crossposted to APR and HTTPD in the first
place. I'll CC this again and answer on HTTPD since it looks like I'm
outvoted :)
On Wednesday 20 October 2010 07:42:59 Branko Čibej wrote:
> On 20.10.2010 07:15, tomas@tuxteam.de wrote:
> > Just a personal data point from a newcomer and mostly lurker: my
> >
> > preferences are, in that order:
> > strcmp(...) == 0
> >
> > !strcmp(...)
> >
> > macro
My own preference is 1, 3, 2. I'm not a big fan of macros either bit
(IMO) it is useful in this case. Or maybe an inline function, like
apr_streq.
> 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.
Actually, I think strcmp is the only case where the preceding comparison
indeed makes sense.
> Agree that macros are worst in this case because they quite handily
> hide the meaning of the expression.
Dunno, IMO the whole strcmp semantic hides the meaning of comparing two
strings for equality and a POSIX streq function would have been a good
idea. Well...
Cheers,
Malte
|