[Oberon] Procedure variables and local procedures

Chris Burrows chris at cfbsoftware.com
Sat Sep 30 04:25:56 CEST 2017

> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> chris
> Sent: Saturday, 30 September 2017 4:21 AM
> To: ETH Oberon and related systems
> Subject: Re: [Oberon] Procedure variables and local procedures
> Very terse. How does it work in the reverse case.
> VAR b : BYTE; i : INTEGER;
> 	i := 1000; b := i;
> Does it trap for overflow?


The details of runtime traps are implementation-specific questions and do
not form part of the language design. 

Runtime overflows (INTEGER as well as BYTE) are not trapped in Project
Oberon or Astrobe Oberon. In fact the Random function exploits this
behaviour and would break if ported to a system that didn't allow you to
turn off overflow trapping. 

If you have no control over the values of the data that reach that point in
your code and you want to trap them (a more subtle scenario than your
example) you should write:

 ASSERT(i <= 255);
 b := i;

Chris (Burrows, that is - I'm not talking to myself ;-))
CFB Software

More information about the Oberon mailing list