[Oberon] Negative integer literals in Oberon

Chris Burrows chris at cfbsoftware.com
Sun Apr 26 06:09:06 CEST 2020


I'm sorry - You have lost me there. How can b, a BYTE, ever validly assume the value of -1 when BYTE is clearly defined in section 6.2 of 'The Programming Language Oberon, Revision 1.10.2013 / 3.5.2016 as:

  BYTE the integers between 0 and 255

Unlike INTEGER, BYTE is always an unsigned quantity.

1) Are you perhaps suggesting that the language should be changed?

2) Am I misunderstanding what you are trying to say?

3) Something else?

Regards,
Chris Burrows
CFB Software
https://www.astrobe.com

> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of Joerg
> Sent: Sunday, 26 April 2020 10:35 AM
> To: ETH Oberon and related systems
> Subject: Re: [Oberon] Negative integer literals in Oberon
> 
> Assume INTEGER i (* 32 bit *)
> i := 7FFFFFFFH;
> i := i + 1;
> 
> The report does not say that you have to do a range check. i = 80000000H.
> if this bit combination is signed or unsigned depends on your output
> procedure: WriteInt vs WriteHex
> 
> Assume BYTE b
> 1) b := 0; b := b - 1;
> 2) i := -1; b := i;
> 
> The report does not say that you have to do a range check. If the
> compiler does not generate a runtime range check, I propse to not do a
> compile time range check and allow b := -1; After 1) and 2)  b = 255;
> 
> br
> J rg
> 
> >> Am 26.04.2020 um 00:17 schrieb August Karlstrom
> <fusionfile at gmail.com>:
> >>
> >> ?On 2020-04-25 18:56, Joerg wrote:
> >> I have a clear opinion on this: it is allowed. But we had a kind of
> >> similar case a few days back when I was attacked to allow b := -1;
> >
> > The language report doesn't say anything about the range of the basic
> types with the exception of BYTE which is defined as the integers between
> 0 and 255. Therefor it is implementation-dependent whether or not an
> integer can be assigned 90909090H. On the other hand it seems reasonable
> to reject the statement b := -1.
> >
> > -- August
> > --
> > Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related
> > systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
> 
> --
> 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