Hello andrew,
Saturday March 13 2021, andrew clarke 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.
ac> Wilfred is right, though I'd prefer nfree() was not used rather than
ac> changing it.
ac> Having a macro modify the variable passed to it just feels like bad
ac> code to me.
There's a lot of bad code here.
ac> But I will leave it.
So be it.
ac> Incidentally I think the "oldest" compiler still supported (properly)
ac> by HPT's build files is Open Watcom 2.0. The OW2.0 fork is an active
ac> project but its WCL386 compiler is still only C95 compliant, as
ac> evident from the internal __STDC_VERSION__ macro being set to 199409.
ac> Though C95 is still newer than ISO/IEC 9899:1990, aka C89/C90.
Some persons emerge from time to time who want to build the sources for DOS. Or maybe that was in BINKD echo...
Michael
... node (at) f1042 (dot) ru
--- GoldED+/LNX 1.1.5-b20180707
* Origin: Moscow, Russia (2:5020/1042)
|