Just a minor new twist on free()

Walter Bright bright at nazgul.UUCP
Thu Nov 1 14:46:04 AEST 1990


In article <280 at audfax.audiofax.com> arnold at audiofax.com (Arnold Robbins) writes:
<In article <117 at nazgul.UUCP> bright at nazgul.UUCP (Walter Bright) writes:
<>    #define free(p)	((p) && free(p))
<Note that this requires an ANSI compliant cpp or C compiler.  The original
<discussion was about using an ANSI compiler with non-ansi libraries, so that's
<fine, but if you try this macro on a pre-ansi cpp it'll recurse forever...

I've used similar constructs on a number of pre-ansi preprocessors, and
it worked fine (it did not recurse). When I implemented a preprocessor,
years before ansi, I made the mistake of it recursing. This was fixed
quickly...



More information about the Comp.lang.c mailing list