Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: why is free() a void? Message-ID: <1990Oct25.152057.23024@zoo.toronto.edu> Organization: U of Toronto Zoology References: <1749@meaddata.meaddata.com> Date: Thu, 25 Oct 90 15:20:57 GMT In article <1749@meaddata.meaddata.com> rob@pmserv.meaddata.com writes: > "void free(void *p) > ... p MUST be a pointer to space previously allocated by calloc, > malloc, or realloc." (Emphasis on MUST by me.) > >What happens if p WASN'T allocated as it should've been?? How do we know >there was a problem?? ... "Bus error - core dumped." Handing free() an improper pointer is a major error, and one that free() is *not* required to catch. It can screw up in any manner it pleases if you do this. There is little point in allowing for a return code just to complain about something you are *never* *ever* supposed to do in the first place. -- The type syntax for C is essentially | Henry Spencer at U of Toronto Zoology unparsable. --Rob Pike | henry@zoo.toronto.edu utzoo!henry