On Saturday, 16 May 2015 at 02:05:22 UTC, Andrei Alexandrescu wrote:
Question, is there a strong rationale for this? The usefulness is obvious if malloc(0) returns null, but otherwise, attempting to free a
resource that has never been created usually indicates a bug.

Yah, you don't want to special case null everywhere: cleanup functions, destructors, etc. etc. If deallocation wouldn't accept the null pointer, "if (p) free(p);" would cause carpal tunnel syndrome. -- Andrei

You should, C is just not a language designed for type safety and correctness.

Reply via email to