Block statements and memory management

Meta jared771 at gmail.com
Sat Mar 16 06:09:54 UTC 2019


On Saturday, 16 March 2019 at 03:47:43 UTC, Murilo wrote:
> Does anyone know if when I create a variable inside a scope as 
> in
> {int a = 10;}
> it disappears complete from the memory when the scope finishes? 
> Or does it remain in some part of the memory? I am thinking of 
> using scopes to make optimized programs that consume less 
> memory.

I'd recommend against these sorts of micro-optimizations. 
Compilers are every good at doing this kind of thing manually so 
you don't have to worry about it and can concentrate on the 
actual logic of your program.


More information about the Digitalmars-d-learn mailing list