In message <[EMAIL PROTECTED]>, Warner Losh writes:

>Number 2.  ANSI-C (aka c89) requires that free(NULL) work.  We
>shouldn't go out of our way to pander to those machines where it
>doesn't.

The reason why this is so is that it is legal for 
        realloc(ptr, 0):
to return either a NULL pointer or a real pointer, and to remain
consistent, the following sequence should always be legal:

        ptr = malloc(foo);
        ptr = realloc(foo, bar);
        free(ptr);

--
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to