#define new(x) (malloc(sizeof(x))) #define dispose(x) { if((x) != NULL) { free(x); } }
Have you ever bothered to read ANSI C specification?
EDIT: Well it appears my recollections of ANSI C have faded away and free(NULL) was actually defined in ANSI C89.
> Have you ever bothered to read ANSI C specification?
You mean the one that states
> The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs.
?
You didn't say which version of the ANSI C specification.
If ptr is a null pointer, no action occurs.