[Oberon] Clarifying type compatibility in Oberon-07

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Thu Oct 12 14:45:24 CEST 2017


> We support an extension in the Astrobe for ARM Cortex-M compilers that
> allows single-dimensional dynamic local array variables. This was originally
> implemented in Wirth's earlier ARM Oberon compiler but not in his RISC5 compiler.
> The NEW command in this case allocates space on the stack (not the heap) for
> the local array. This is elegant because it doesn't require any corresponding
> DISPOSE or garbage collection - the space is automatically reclaimed when
> the procedure is exited. The example above then becomes: 
> 
> PROCEDURE P(s: ARRAY OF CHAR); 
>   VAR local: ARRAY OF CHAR; 
> BEGIN 
>   NEW(local, LEN(s)); 
>   local := s; 
>   ...

That’s a great idea!! So NEW(a, size) only touches the stack but not the heap,
making both allocation and reclamation (which is of course implicit on procedure
exit by simply adjust the stack pointer) super-fast.

I will consider adding that to my version of the compiler!

-AP

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20171012/931ded33/attachment.html>


More information about the Oberon mailing list