[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] nanomiscbugs2 update
From: |
David Benbennick |
Subject: |
Re: [Nano-devel] nanomiscbugs2 update |
Date: |
Wed, 20 Nov 2002 18:54:34 -0500 |
User-agent: |
Mutt/1.2.5.1i |
On Thu, Nov 07, 2002 at 08:58:29PM -0800, David Lawrence Ramsey wrote:
> * for consistency, changed some instances of "if (x ==
> NULL)" to "if (!x)" and "if (x != NULL)" to "if (x)"
I wonder whether this is a good idea. Here are two reasons it might not
be:
1) It's natural to distinguish three types of variables: booleans,
numbers, and pointers. Saying "if (x)" signals that x is a boolean, with
only two values. Indeed, Java enforces this style. Blurring the
difference between pointers and booleans doesn't make the code easier to
understand.
2) Lots of functions are documented as returning NULL for certain
conditions, but I don't know of anything saying NULL is necessarily 0. It
just happens to be on every real system.
Anyway, in my opinion it's (slightly) better to explicitly test for NULL.
pgpsd62Fd_n9L.pgp
Description: PGP signature