Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!texbell!nuchat!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: `static foo array[SIZE]' is not `malloc()' (Re: free (NULL);) Message-ID: Date: 9 May 90 19:05:12 GMT References: <1194@wet.UUCP> <19461@duke.cs.duke.edu> <5804@buengc.BU.EDU> Reply-To: peter@ficc.uu.net (Peter da Silva) Organization: Xenix Support, FICC Lines: 26 In article <5804@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: > Using this function the array test[] will be allocated > exactly once during the execution of the program, and the > same value will be returned no matter how many times > squirl() is called. If you want two blocks of 100 char's > simultaneously, this won't work. Unfortunately, neither will the original proposal: char *foo() { static char *buffer = NULL; free(buffer); ... buffer = malloc(...); return buffer; } Unless you *like* dereferencing freed pointers, that is. What it *will* do is let you deal with large objects without chewing up lots of BSS. -- `-_-' Peter da Silva. +1 713 274 5180. 'U` Have you hugged your wolf today? @FIN Commercial solicitation *is* accepted by email to this address.