why is free() a void?
Rahul Dhesi
dhesi%cirrusl at oliveb.ATC.olivetti.com
Fri Oct 26 03:21:30 AEST 1990
>>...I'm curious as to why free() does not return a value.
Yes, free() could legitimately return an error code if it detected
something wrong. A debugging version of the memory allocation library
could always have free() return a useful value, and even production
versions could sometimes return an error indication.
Also, a signal handler (*handler)() installed by signal() could
legitimately return a status code for use by the kernel.
Both free() and (*handler)() used to return int at one time. The
availability of the `void' data type, and a certain religious desire to
be "pure", seem to have made both functions now return nothing. It's a
loss.
--
Rahul Dhesi <dhesi%cirrusl at oliveb.ATC.olivetti.com>
UUCP: oliveb!cirrusl!dhesi
More information about the Comp.lang.c
mailing list