[Oberon] CASE without ELSE
Diego Sardina
dsar at eml.cc
Thu Feb 15 17:59:01 CET 2018
On Thu, Feb 15, 2018, at 4:12 PM, Jörg wrote:
>
> If you write something like this
> CASE idx OF
> 0: idx := idx + 42
> | 2000: idx := idx * 2
> ELSE
> END
> and the compiler would implement it with a table, you have 1999
> useless entries.
In the past Pascal and Modula-2 compilers always limited case labels to
127 or 255, these two limitsare also reasonable today and the entries' loss is very negligible.
> NW seems to have changed his mind on CASE. The compiler itself rarely
> uses CASE these days. eg ORS.Get() formerly THE case for CASE uses
> cascaded IFs>
In "An Oberon Compiler for the ARM Processor", he wrote: The scanner is
one of the few routines where a case statement is highly valuable.
I agree with that not only for the constant time of the jump table but
for the aesthetic, it is a nightmare how it was coded in current
PO2013 :-)
--
Diego Sardina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180215/8b9b3ba0/attachment.html>
More information about the Oberon
mailing list