Unfortunately, a large number of programers also seem to use NULL for the 0
character at the end of a string as:
  char* ptr;
 if (*ptr == NULL)

which makes the first definition the best one. The L is usually not
necessary because of implicit type conversion. Most compilers also seem do
do implicit type conversion between 0 and (void*)0
(or any other pointer type for that matter)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Butch
Howard
Sent: Thursday, August 24, 2000 07:04
To: Palm Developer Forum
Subject: RE: Codewarrior and Function Prototypes warning. Lesson
learned.


I think this is the fault of the #define for the NULL macro.  A grep for the
files installed with CW Palm R6 shows these defines in various files:

#define NULL 0
#define NULL 0L
#define NULL (void*)0

Of these (IMO), the only correct one is (void*)0.  The worst of the lot is
the simple 0, which happens to be the one defined in Common.h. If the define
is corrected to either force a long or (more correctly to me) to force a
pointer-sized value, the code would be generated correctly without the
prototype.  NULL and other common constants should be defined to be as
non-ambiguous as possible.

(Mind you, I also think prototypes should always be required).

...
>
> PS: Rereading this someone might think that I'm blaming
> codewarrior.  Not at all!  It was definitely  a user error
> (most likely
> mine).
...
> Here is the mixed assembler/C source from the debugger:
>               err = CreateRecord(NULL);

--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to