[Oberon] Negative integer literals in Oberon

Jörg joerg.straube at iaeth.ch
Mon Apr 27 10:16:37 CEST 2020

The whole discussion is based on the assumption that the MSB of a 32 bit value is the sign of an INTEGER.
That is not defined in the report. This is left to the implementation.
The only means in the Oberon-07 language to influence the sign bit is by using calculations involving "-".

0FFFFFFFFH has no sign operation, so can't be negative.
-6AB3H has a "-", so is negative


Am 27.04.20, 10:04 schrieb "Oberon im Auftrag von Jörg" <oberon-bounces at lists.inf.ethz.ch im Auftrag von joerg.straube at iaeth.ch>:

    How the sign bit for INTEGER values have to be stored is NOT defined in the report. This is part of the presentation layer that is deliberately left to the implementation.
        1. Should the following assertion be successful?
    No, on a 32 bit machine with simple presentation layer implementation
    Yes, on a 32 bit machine with clever presentation layer implementation.
    Yes, on a 64 bit machine.
        2. Should the compiler accept the following statement?
              i := i DIV 0FFFFFFFFH;
    Yes, why not? Just look at the case where INTEGER is 8 bytes.
    But be aware: as I said H has two different flavors: one H usage is used in INTEGER arithmetic (just use decimal notation and hexadecimal notions for the same INTEGER values, there I wonder why you would do that anyway). And the second H usage (and this is in my experience the usage most have in mind when they use H: low-level programming where you need bit patterns and don't care about the internal presentation layer of INTEGERs that is - as we know - not defined in the Oberon report.
    Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems

More information about the Oberon mailing list