why is free() a void?

Walter Bright bright at nazgul.UUCP
Fri Nov 9 05:42:11 AEST 1990


In article <5241 at ima.ima.isc.com> karl at ima.isc.com (Karl Heuer) writes:
/In article <130 at nazgul.UUCP> bright at nazgul.UUCP (Walter Bright) writes:
/>Thus, it became apparent that the abort should be moved inside of free().
/>That's what the Zortech free function does now, if it detects a corrupted
/>heap it prints the message:
/>	"Heap is corrupted"
/>and immediately terminates the program. free() now returns a void.
/Good for you.  I hope you die with abort() or equivalent rather than exit()
/(even if the distinction is minor under DOS); then you can answer the diehards
/by telling them to trap SIGABRT.

No, the function exits immediately to DOS, it does not pass Go and does not
collect $200. My reasoning is that the program *has already crashed* and
must be stopped *as soon as possible* to avoid corrupting the FAT or some
other critical area.

The library source comes with the Developer's Edition, and if someone wishes
to change this behavior, it would not be very difficult. But someone
doing this I think would need a very good reason for it.



More information about the Comp.lang.c mailing list