From: Eric Rudd Newsgroups: comp.os.msdos.djgpp Subject: Re: Freeing null Date: 26 Feb 1997 16:26:07 GMT Organization: CyberOptics Corp Lines: 18 Message-ID: <5f1o6v$ptr@hagar.cyberoptics.com> References: <5etnpb$42p AT freenet-news DOT carleton DOT ca> <3314684D DOT 51C1 AT blackmagic DOT tait DOT co DOT nz> NNTP-Posting-Host: rudd.cyberoptics.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Bill Currie 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