TIP: Click on subject to list as thread! ANSI
echo: fidosoft.husky
to: Michael Dukelsky
from: andrew clarke
date: 2021-03-13 19:53:00
subject: Htick Hatching

On 2021-03-12 15:30:48, Michael Dukelsky (2:5020/1042) wrote to Wilfred van Velzen:

 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 not
 MD> change it because I do not know whether free() always worked as it works
 MD> now or it did not test the pointer for NULL in some ancient systems.

Wilfred is right, though I'd prefer nfree() was not used rather than changing it.

Having a macro modify the variable passed to it just feels like bad code to me. But I will leave it.

Incidentally I think the "oldest" compiler still supported (properly) by HPT's build files is Open Watcom 2.0. The OW2.0 fork is an active project but its WCL386 compiler is still only C95 compliant, as evident from the internal __STDC_VERSION__ macro being set to 199409.

Though C95 is still newer than ISO/IEC 9899:1990, aka C89/C90.

--- GoldED+/BSD 1.1.5-b20180707
                   
* Origin: Blizzard of Ozz, Melbourne, Victoria, Australia (3:633/267)

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