Re: [PATCH] Use NULL instead of integer 0 in security/selinux/

From: Paul Jackson
Date: Sat Jul 10 2004 - 18:54:01 EST


(off-topic alert)

> if (0 != i)

Does anyone know of the origins of writing such tests this way, rather
than:

if (i != 0)

I read the first as testing whether "0" has a certain property, which is
a silly thing to test, since the properties of "0" are rather constant.

The second form I read as testing a property of "i" - much more
interesting. Logically, the same, of course. Just a question of which
form is more idiomatic.

Back in the days when it was Ken, Dennis and Brian, not K & R, I don't
recall seeing the first form used much. Even now I see _zero_ matches
on "if (0 " in kernel or mm - only in arch, drivers, net, scripts, and
sound (with a single time.h exception).

If I were Linus, I'd vote the first form off the island. Then again,
if I were Linus, you would never have heard of Linux ;).

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
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/