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

Hello Wilfred,

Friday March 12 2021, Wilfred van Velzen wrote to Michael Dukelsky:

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

 WV>>> And the test for NULL isn't necessary, because free() is by
 WV>>> definition 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
 MD>> not change it because I do not know whether free() always worked
 MD>> as it works now or it did not test the pointer for NULL in some
 MD>> ancient systems.

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

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

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

OK, thanks.

Michael

... node (at) f1042 (dot) ru
--- GoldED+/LNX 1.1.5-b20180707
                                                                  
* Origin: Moscow, Russia (2:5020/1042)

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™.