[Oberon] Assumed issue in the Lola-2 compiler

Paul Reed paulreed at paddedcell.com
Mon Apr 15 12:02:37 CEST 2019


>>> if x=-1, then I would assume the result of this assignment would be 
>>> zero.
>>> Unfortunately, yes.

Sorry for any confusion: you said,

> The critical statement is "x := x DIV 10H"; if x=-1, then I would 
> assume the result of this assignment would be zero, or am I wrong?

I was saying unfortunately, yes, you are wrong, not yes, you are right.

The result of x [= -1] DIV 10H is -1, because it is implemented as an 
arithmetic shift right, in turn because the divisor is a constant power 
of two.  This is an Oberon idiom, you would not want to change the 
Oberon code because you'll be doing that until the cows come home...

Apologies again, if I confused things even further for you :(

Cheers,
Paul


More information about the Oberon mailing list