Steve Mann <[EMAIL PROTECTED]> wrote:
>> You mean "null" not "NULL".
>> NULL is a typed as a void pointer in C, not a character.
>
> That may be true for C, but the Palm headers define NULL this way:
>
> #ifndef NULL
> #define NULL 0
> #endif // NULL
I'm not sure what your point is, but that is indeed how the Palm headers
define NULL. For the 4.0 SDK, I intended to change this to
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
which provides the best portable null pointer constants in C and C++. (The
"(void *)0" definition in C enables better error checking, but is not a null
pointer constant according to the C++ definition.)
There are three reasons why I didn't make this change:
* The C change, while enabling better error checking, would detect errors
in people's existing sloppy source code. They might not care about being
warned about this particular maintenance problem, and might think that
the new SDK had gratuitously failed to compile their programs.
* Various C++ compilers can do better than the generic `0' definition.
For example, G++ defines it as the builtin constant __null, which enables
better error detection and resolution of ambiguous overloading.
* Conscientious programmers can already get the best possible definition of
NULL in their C and C++ programs by asking for it in the way God, X3J11,
and SC22/WG21 intended:
#include <stddef.h>
#include <PalmOS.h>
// ...code uses the NULL from the compiler's stddef.h,
// not from PalmTypes.h
John "Actually he means `NUL' or `'\0'' or `null character'"
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/