On Mon, 4 Jun 2007, Pekka Enberg wrote: > > Then we might as well return your regular NULL pointer for zero-length > allocations as you can't do anything sane with ZERO_SIZE_PTR either.
No. NULL really _is_ special. We use NULL in tons of places for saying "we haven't allocated anything at all". That's *not* the same as saying "we have initialized this pointer, it just happens to point to a zero-sized object". Two *totally* different things. I don't understand why people mix them up. We literally have code that tests pointers for NULL to determine if the subsystem has been initialized. In other words: YOU MUST NOT RETURN NULL FOR A "SUCCESSFUL POINTER ALLOCATION", regardless of the size. Yeah, yeah, I realize that the C library traditionally allows it, and user space is used to it, but it's still wrong and stupid. We can do so much better. When malloc() returns NULL, it means that it failed. When a pointer is NULL, it means that it doesn't exist. And ZERO_SIZE_PTR is _neither_ of those cases! Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/