[Oberon] Procedure variables and local procedures
chris at gcjd.org
Sat Sep 30 12:09:32 CEST 2017
On Sat, 30 Sep 2017 11:55:56 +0930, Chris Burrows wrote:
>> VAR b : BYTE; i : INTEGER;
>> i := 1000; b := i;
>> Does it trap for overflow?
> 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.
Sorry my wording was not precise enough. I did not mean arithmetic
I thought of the situation where Oberon requires the use of SHORT which
clearly indicates that the range is reduced in this operation.
I would expect from an integer type that an assignment from one integer
variable to another with a different range traps if the current value
of the right side variable is not in range of the left side variable
unless the programmer requested this behavior.
Especially when the mode of shortening is undefined in the language.
More information about the Oberon