www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/10/03:18:23

Date: Mon, 10 Nov 1997 10:16:02 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: sl <SL AT usemail DOT com>
cc: DJGPP mailing list <djgpp AT delorie DOT com>
Subject: Re: Program with functions
In-Reply-To: <199711091926.OAA12087@delorie.com>
Message-ID: <Pine.SUN.3.91.971110101534.13667J-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019