[Oberon] Procedure variables and local procedures

Chris Burrows chris at cfbsoftware.com
Sat Sep 30 14:07:32 CEST 2017


> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> chris
> Sent: Saturday, 30 September 2017 7:27 PM
> To: ETH Oberon and related systems
> Subject: Re: [Oberon] Procedure variables and local procedures
> 
> On Sat, 30 Sep 2017 02:33:16 +0200, Jörg wrote:
> >> VAR b : BYTE; i : INTEGER;
> >>    i := 1000; b := i;
> >>
> >> Does it trap for overflow?
> >
> > The compiler does not generate a trap. It moves the lowest byte of
> i
> > to b. See first IF in ORG.Store.
> 
> Well, that is considered good style? In my opinion this kind of low
> level action should not be in the base language. 

It is NOT in the base language. Jörg is simply describing the behaviour in a
particular implementation. At best it is an 'undocumented feature' that
cannot be relied upon. 

> If it's defined to
> be "least significant byte" that would be a bit better, but this
> could result in some surprise on different hardware.
> 
> Leaving this undefined in the language report makes the type BYTE an
> unusable feature for portable programs.
>

It is NOT defined because it is an error - surely that doesn't have to be
spelt out? Error-handling is implementation-specific. There is no guarantee
whatsoever that erroneous programs will behave the same way on different
systems.
 
Regards,
Chris Burrows
CFB Software
http://www.astrobe.com




More information about the Oberon mailing list