The thorny case of kmalloc(0)
Posted Jun 7, 2007 10:02 UTC (Thu) by
evgeny (guest, #774)
Parent article:
The thorny case of kmalloc(0)
> The problem here is that a NULL pointer is already loaded with meaning. It says that the allocation has failed
Right, but inventing ZERO_SIZE_PTR doesn't solve this problem; instead it delegates the punishment of the extra check to all possible users of the object, i.e. instead of
if (!a) {
allocate(a) || die;
}
one has to use
if (!a || a == ZERO_SIZE_PTR) everywhere. Not?
PS. Why in the "Plain text" format the indentation is not preserved?
(
Log in to post comments)