# The differences between integer & long hexadecimal literals in Oberon dialects #56

Closed
opened this issue Feb 10, 2019 · 0 comments

Projects
None yet
1 participant
Owner

### Oleg-N-Cher commented Feb 10, 2019

 Historically, the LONGINT type in Oberon/Oberon-2 has size 32 bits. And increasing the bit depth of LONGINT type will break compatibility with existing source code. To avoid this problem, some Oberon-implementations use a non-standard type HUGEINT, although it is not present in the description of the Oberon/Oberon-2 language. Therefore, we can consider the type HUGEINT only as a language extension. Accordingly, we should consider the declaration of constants of this type as a language extension too. With this in mind, and with the need to maintain existing code, we have introduced a new (non-standard) suffix 'L' to declare long hexadecimal literals of (non-standard) type HUGEINT. As you know, in Oberon/Oberon-2 the real numbers of single precision are written with the suffix "E" (2.44E15), and of double precision -- with 'D' (2.44D15). In Component Pascal, there is no longer the suffix 'D', since there are no single-precision numbers -- all calculations are performed in double. But still, by analogy with this solution in Oberon/Oberon-2, to use the suffix 'L' for long hexadecimal literals seems to be a reasonable solution, only expanding the range of numbers, but not breaking the old code with 32-bit literals. Ofront+ implements the following ways to define the hexadecimal literals: -1, -2 (Oberon, Oberon-2): 'H' for 32-bit literals, 'L' for 64-bit literals. Compatible with old code. New code uses 'L' and HUGEINT type as the Oberon/Oberon-2 extensions. -C (Component Pascal): 'H' for 32-bit literals, 'L' for 64-bit literals. Compatible with Component Pascal. -7 (Oberon-07): 'H' for INTEGER literals. If a literal > MAX(INTEGER), you receive a compiler warning. The ability to define longer numbers than allowed needed to interact with code in other dialects and to be able to specify literals of the type SYSTEM.INT64). -3 (Oberon-3, the experimental dialect): 'H' for literals of any integer type. For force converting a LONGINT constant to INTEGER it is offered to use SYSTEM.VAL. This is a normal solution for system conversion of a set of bits into a set of bits with losses. Note that Oberon/Oberon-2 and Component Pascal have the ability to specify a number sign in the literal implicitly, whereas Oberon-3 and Oberon-07 don't allow it. We decided that it would be wrong to allow implicit sign assignment and any manipulations with a number at the bit level. "Integers are not bits" (Niklaus Wirth)

### Oleg-N-Cher added a commit that referenced this issue Feb 10, 2019

``` / issue #56: the differences between integer & long hexadecimal liter… ```
`…als in Oberon dialects.`
``` 6abcde5 ```

### Oleg-N-Cher added a commit that referenced this issue Feb 11, 2019

``` * issue #56: the differences between integer & long hexadecimal liter… ```
`…als in Oberon dialects.`
``` 4033faa ```