TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: Michael Dukelsky
from: Wilfred van Velzen
date: 2021-03-12 13:52:00
subject: Re: Htick Hatching

Hi Michael,

On 2021-03-12 15:30:48, you wrote to me:

 ac>>> #define nfree(a) {if(a != NULL) {free(a); a = NULL;}}

 WV>> And the test for NULL isn't necessary, because free() is by definition
 WV>> doing nothing if the pointer passed to it is NULL.

 MD> Yes, I know it. It was written long ago and not by me and I do not change
 MD> it because I do not know whether free() always worked as it works now or it
 MD> did not test the pointer for NULL in some ancient systems.

The Second Edition (1988) of The C Programming Language by Kernighan & Ritchie (describes C as defined by the ANSI standard), already describes it as follows:

void free(void *p)
  free deallocates the space pointed to by p; it does nothing if p is NULL. p must be a pointer to space previously allocated by calloc, malloc, or realloc.

So I think you are save to assume it "always" worked that way! ;)

Bye, Wilfred.

--- FMail-lnx64 2.1.0.18-B20170815
                                                 
* Origin: FMail development HQ (2:280/464)

SOURCE: echomail via QWK@pharcyde.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.