[uClibc]behaviour of malloc(0)

Erik Andersen andersen at codepoet.org
Sun Sep 22 10:57:04 UTC 2002


On Sun Sep 22, 2002 at 03:00:07PM +0800, Rogelio Serrano wrote:
> Should malloc(0) return successfully?

According to SuSv3:
http://www.opengroup.org/onlinepubs/007904975/functions/malloc.html

 Upon successful completion with size not equal to 0, malloc()
 shall return a pointer to the allocated space. If size is 0,
 either a null pointer or a unique pointer that can be
 successfully passed to free() shall be returned. Otherwise, it
 shall return a null pointer and set errno to indicate the error.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list