From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: "Douglas A. Gwyn" Message-ID: <3B0C195D.4075CE42@null.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <20010523184601.06BA519A1C@mail.cse.psu.edu> Subject: Re: [9fans] software quality and popularity Date: Thu, 24 May 2001 08:46:27 +0000 Topicbox-Message-UUID: a74011f8-eac9-11e9-9e20-41e7f4b1d025 David Gordon Hogan wrote: > | As a special case, alloca(0) reclaims storage without > | allocating any. It is a good idea to use alloca(0) in > | your main control loop, etc. to force garbage collection. */ The storage reclamation occurs anyway. The documentation is misleading; the actual "special case" is that alloca() always reports failure to allocate storage for a 0-sized object. This could easily be changed (to successfully allocate a header-only chunk, basically just remove the short-circuit that was added to make garbage collecting more efficient), if C were ever changed to support 0-sized objects. By the way, my alloca implementation was meant as a transitional measure only; I hope you're not writing new code that relies on alloca. It's not feasible to implement on some architectures.