[Oberon] Initial value of variables, where specified?

Joerg joerg.straube at iaeth.ch
Wed Feb 12 17:44:51 CET 2020


Rochus
As DisplayLine() is not exported, its validity scope is the module
TextFrames alone.
In TextFrames, before DisplayLine() is called, OpenReader(); Read(nextCh) is
called.
br
Jörg

-----Original Message-----
From: Oberon <oberon-bounces at lists.inf.ethz.ch> On Behalf Of
rochus.keller at bluewin.ch
Sent: Wednesday, February 12, 2020 4:04 PM
To: oberon at lists.inf.ethz.ch
Subject: Re: [Oberon] Initial value of variables, where specified?

@  Chris Burrows

Thank you very much for your response. Meanwhile I also found an example of
a module level variable which is used before explicit initialization: e.g.
nextCh in TextFrames.Mod where the first test "nextCh # CR" in procedure
DisplayLine was non-deterministic if nextCh were not automatically
initialized.

Best
R.


_______________________________
From: Chris Burrows
Sent on: Wed, 12 Feb 2020 02:06:12 +0100
To: ETH Oberon and related systems
Cc: 
Subject: Re: [Oberon] Initial value of variables, where specified?

The value a variable is supposed to have before it is explicitly assigned a
value is not defined in the latest Oberon Language Report.

In Project Oberon dynamic variables are initialised to zero when they are
allocated by NEW. The relevant code is in Kernel.New:

WHILE p < lim DO SYSTEM.PUT(p, 0); INC(p, 4) END

Regards,
Chris Burrows
CFB Software
https://www.astrobe.com
--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list