[Oberon] ORD for typecasting Pointers (was: Module Fonts without reference to SYSTEM)
chris at cfbsoftware.com
Sat Sep 5 06:21:12 CEST 2020
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Sent: Saturday, 5 September 2020 5:35 AM
> To: Oberon List
> Subject: [Oberon] Module Fonts without reference to SYSTEM
> Below is one way to do it. It used ORD for pointers (undocumented
If not a bug, at best I would classify the ability to use ORD to typecast a
pointer to an INTEGER as a 'loophole'. Refer to the Section titled
'Loopholes' in 'Good Ideas, Through the Looking Glass', Niklaus Wirth 2005.
This loophole is exploited in several modules in Project Oberon. Fortunately
all but one occurrence can be eliminated by replacing ORD(...) with
SYSTEM.VAL(INTEGER, ...) as all of those modules already import SYSTEM.
The remaining occurrence is in Texts.WriteReal
e := ASR(ORD(x), 23) MOD 100H; (*binary exponent*)
Texts does not already IMPORT SYSTEM. However, that does not matter as a
more suitable replacement in this instance is:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon