<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">We support an extension in the Astrobe for ARM Cortex-M compilers that</span><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">> allows </span><span style="font-family: monospace; white-space: pre-wrap;" class="">single-dimensional dynamic local array variables. This was originally</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> implemented in Wirth's earlier ARM Oberon compiler but not in his RISC5 compiler.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> The NEW command in this case allocates space on the stack (not the heap) for</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> the local array. This is elegant because it doesn't require any corresponding</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> DISPOSE or garbage collection - the space is automatically reclaimed when</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> the procedure is exited. </span><span style="white-space: pre-wrap; font-family: monospace;" class="">The example above then becomes: </span><div class=""><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> 
> PROCEDURE P(s: ARRAY OF CHAR); 
>   VAR local: ARRAY OF CHAR; 
> BEGIN 
>   NEW(local, LEN(s)); 
>   local := s; 
>   ...</span></font></div></div></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">That’s a great idea!! So NEW(a, size) only touches the stack but not the heap,</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">making both allocation and </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">reclamation (which is of course implicit on procedure</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">exit by simply adjust the stack pointer) super-fast.</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">I will consider adding that to my version of the compiler!</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">-AP</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div></body></html>