Re: [cc65] NULL descrepency

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2006-04-06 11:23:39
On Thu, Apr 06, 2006 at 05:08:26AM -0400, Andrew J. Kroll wrote:
> This should actually be:
>
> /* NULL pointer */
> #ifndef NULL
> #define NULL    (void *)0
> #endif

No. A constant integer value of zero *is* a NULL pointer constant. Many people
have problems understanding what a NULL pointer in C is. For example that it
is different from a binary value of 0, and that memset with zero does not
generate NULL pointers. The FAQ for comp.lang.c contains a discussion of this
topic. You may want to have a look at it.

The reason why other compilers use "(void*)0" is because the C++ compilers
need this, and it's also valid for C.

> We have the cbm.h file which calls on the other CBM platforms, atari.h, apple,
> and so on. Would it not make sense that if we have these particular headers
> which grab OS dependencies, to point any header at the proper header, and if
> you have them reentrantly wrapped with #ifdef _CC65_STDDEF_H_SEEN_ (example)
> more code can compile out of the box. This makes total sense to me, and how
> the many other cross compilers do it... with the pre-set cpp macros...
> Why not follow suit?

I do not really understand what you mean. Could you please elaborate?

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Apr 6 11:23:48 2006

This archive was generated by hypermail 2.1.8 : 2006-04-06 11:23:50 CEST