0 and pointers.( Re: Abandon NULL for (0))

Dave Jones djones at megatest.UUCP
Sat Oct 7 07:20:16 AEST 1989


By the way, here's a mistake I see quite often. It makes no
difference on many machines, but on architectures where casting
an integer to a pointer in not a NOP, you are in trouble with this:

foo()
{
  char *mem = (char*)malloc(STRLEN);

  /* etc... */

}


Of course you should say,

extern char* malloc();

foo()
{
  char *mem = malloc(STRLEN);
  /* etc. */
}



More information about the Comp.lang.c mailing list