Mail Archives: djgpp/1997/02/26/19:52:47
Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz> wrote:
>Roland Acton wrote:
>>
>> Paul Derbyshire (ao950 AT FreeNet DOT Carleton DOT CA) wrote:
>>
>> : What are the effects of free(ptr) if ptr happens to be null?
>Returns the allocated memory to the heap (*note malloc::.). If the PTR
>is `NULL', it does nothing.
As a matter of fact, this behavior is required by the ANSI/ISO
standard. In sub-clause 7.10.3.2, it is stated that "If _ptr_ is
a null pointer, no action occurs." Thus, free(NULL) is not only
accepted by gcc; it can be used in portable programs.
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -