Path: utzoo!telly!attcan!uunet!meaddata!rob From: rob@meaddata.com (Robert E. Lancia) Newsgroups: comp.lang.c Subject: why is free() a void? Message-ID: <1749@meaddata.meaddata.com> Date: 24 Oct 90 14:20:58 GMT Sender: usenet@meaddata.com Reply-To: rob@pmserv.meaddata.com Organization: Mead Data Central, Dayton OH Lines: 25 As the subject says, I'm curious as to why free() does not return a value. (At least on our SPARCstations, SUN 3's and 4's, RT's and Sequent, free() is a void function.) It seems to me that it could pass back some useful information, especially if there was a problem. Was the pointer NULL, or an invalid address?? Was the memory not allocated by malloc() or it's siblings?? From K&R 2, page 252: "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?? Is there really a problem?? Any ideas? -- |Robert Lancia | Mead Data Central |(513) 297-2560 | Data Services Division |rob@pmserv.meaddata.com | P.O. Box 308 |...!uunet!meaddata!pmserv!rob | Dayton, Ohio 45401