Re: [RFC][PATCH 01/11] ftrace/trivial: Clean up recordmcount.c touse Linux style comparisons

From: Steven Rostedt
Date: Fri Apr 22 2011 - 12:05:49 EST


On Fri, 2011-04-22 at 12:52 -0300, Thiago Farina wrote:
> On Fri, Apr 22, 2011 at 12:09 PM, John Reiser <jreiser@xxxxxxxxxxxx> wrote:
> > I consider "0==strcmp(" to be an idiom. Too often "strcmp(...) == 0"
> > overflows my mental stack because of the typographic width of the operands
> > in the source code. If you still object in this case then please consider
> > using something like:
> > #define strequ(a,b) (strcmp((a), (b)) == 0)
> > or
> > static int strequ(char const *a, char const *b)
> > {
> > return strcmp(a, b) == 0;
> > }
> > which names the idiom.
> >
>
> Maybe str_eq? Or even just streq? And also just !strcmp(a,b).

streq() is something I woudn't mind.

I've too often confused !strcmp(a,b) as "!streq()" which is not the
case. Which is why I always use strcmp(a,b) == 0, which to me I see the
'==' as eq. I also consider strcmp(a,b) != 0 as not equal. Again, the
mind that sees "==" and "!=" can just translate that to human language.
Where !strcmp() is just gibberish ;)

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/