Casting call

Wayne A. Christopher faustus at ucbcad.UUCP
Fri May 24 17:22:46 AEST 1985


> >> #define FREE(ptr)	{  free((char *) ptr); ptr = (typeof ptr) NULL;  }
> 
> > ... If we were using ANSI C, ...
> 
> One doesn't even need any of the new ANSI C features:
> 
> #define	FREE( ptr )	( free( (char *)ptr ), ptr = NULL )
> 
> since one can always assign 0 (NULL) to any pointer type.

The original problem was that NULL is a valid address under 4.{2,3},
but (char *) -1 isn't. This is, of course, dependent on 4.2 and
the VAX.

	Wayne



More information about the Comp.lang.c mailing list