why is free() a void?

house ron s64421 at zeus.usq.edu.au
Mon Oct 29 23:13:56 AEST 1990


rh at smds.UUCP (Richard Harter) writes:

>Niels J|rgen Kruse comments:

>>   If thre is no adjacent control information, the array overwrite
>>   will just scribble over some of the data you have in the next
>>   block.  This is not a source of mystery bugs?  Your program may
>>   not dump core, but the output will be slightly corrupted.  Ugh.

>Quite true -- array overwrites are bugs.  There are two philosophies
>about how utilities should respond to incorrect input, i.e. bugs.
>One approach says that the utility is not obliged to do anything
>predictable in response to errors because you should never write
>code with errors in it.

>Much as I admire people who can actually write code that is error
>free I must admit that I am not one of them -- I make mistakes from
>time to time.  As a result I prefer a more robust approach which says
>that utilities should help you as much as is feasible when you make
>mistakes.

Actually, the way a utility can help _me_ when I overwrite memory is
by causing the most drastic crash possible a.s.a.p.!  Trying to
minimise the effects of an error is useful if the error gets past
the checking stage, but it makes it _much_ more likely that errors
_do_ escape notice.  A good ol' segmentation fault tends to alert you
to problems!
-- 
Regards,

Ron House.   (s64421 at zeus.usq.edu.au)
(By post: Info Tech, U.C.S.Q. Toowoomba. Australia. 4350)



More information about the Comp.lang.c mailing list