[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] nanomiscbugs2 update
From: |
Chris Allegretta |
Subject: |
Re: [Nano-devel] nanomiscbugs2 update |
Date: |
Thu, 21 Nov 2002 05:38:47 -0800 |
User-agent: |
Mutt/1.2.5.1i |
On Wed, Nov 20, 2002 at 06:54:34PM -0500, David Benbennick wrote:
> 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.
I would tend to agree. I also like testing for == 0 or !=0 as well,
just because it makes the program easier to read (I absolutely hate
!variablename). This may be overkill though ;-)
Chris A
--
Chris Allegretta http://www.asty.org
"Share and Enjoy" - Douglas Adams, 1952 - 2001