Mail Archives: djgpp/1997/11/10/03:18:23
On Sun, 9 Nov 1997, sl wrote:
> This is doable but still not comfortable.. There has to be a
> better way.. Doesn't automatic disposing or something exist?
It does: it's called `alloca'. It works like `malloc', but allocates
the storage off the stack, so when your function returns, that storage
is automagically deallocated.
Caveat: since the default stack is 256KB-long, this technique is
dangerous if you need large buffers. But for small (say, up to 10K)
buffers, it is ideal.
- Raw text -