>> #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.