Re:Once upon a time, memory allocators made sense
by jheriko on Thursday January 21, 2016 @06:21AM
(#10944549)
thats not even close to reasoning imo, its just an assertion.
... but i agree that the code is safer if you check for bad cases.
i can't see why allocating zero ever is more sensible than not doing it at all (and therefore avoiding even having to know about this problem, much less deal with it).
No, allocating zero bytes is a perfectly reasonable thing to do, as long as you remember that NULL is not necessarily an allocation failure.
is perfectly good code.