www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/13/06:57:16

Date: Tue, 13 Aug 1996 13:51:35 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Francois Charton <deef AT pobox DOT oleane DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: Freeing and not freeing Windoze memory
In-Reply-To: <32105403.267E@pobox.oleane.com>
Message-Id: <Pine.SUN.3.91.960813134547.28748b-100000@is>
Mime-Version: 1.0

On Tue, 13 Aug 1996, Francois Charton wrote:

> BTW, do you think it would be possible for a compiler to optimise the use 
> of memory (i.e. allocate in the stack whenever it is safe and possible, 
> and in the heap in other time). Comments anyone ?

For this to be done, the compiler should be smart enough to know whether
the pointer returned by the memory-allocation function should remain valid
outside the current block.  If it should, `alloca' cannot be used, since
its storage is automagically freed when the stack is popped.  As C has the
usual pointer-aliasing problems, I suspect this is beyond the current
level of source code analysis done by any reasonable compiler (many of
them don even have an `alloca', or have one with a buggy implementation). 
Imagine how many complains about gcc slow compiles will we see if a
compiler would to make such an analysis!  Thanks, but no, thanks!

- Raw text -


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