Re:Xcode 4 ships a buggy compiler
by nitrogen on Saturday December 31, 2011 @03:45AM
(#3410500)
as is the assumption that free(NULL) won't corrupt the heap.
When you refer to simplifying assumptions, are you talking about assumptions made by the programmer, or by the compiler and libc? For example, the POSIX manual page[0] for free( void* ptr ) says, "If ptr is a null pointer, no action shall occur." The malloc manpage says, "If size is 0, either a null pointer or a unique pointer that can successfully passed to free() shall be returned." That sounds more like a definition than an assumption to me. What am I missing?
[0] Obtained by installing manpages-posix-dev on Ubuntu and running man 3posix free.
When you refer to simplifying assumptions, are you talking about assumptions made by the programmer, or by the compiler and libc? For example, the POSIX manual page[0] for free( void* ptr ) says, "If ptr is a null pointer, no action shall occur." The malloc manpage says, "If size is 0, either a null pointer or a unique pointer that can successfully passed to free() shall be returned." That sounds more like a definition than an assumption to me. What am I missing?
[0] Obtained by installing manpages-posix-dev on Ubuntu and running man 3posix free.