Compiler TRAPs with simple CONST expression

Re: Compiler TRAPs with simple CONST expression

Postby cfbsoftware » Thu Jun 11, 2020 12:14 pm

This is an interesting one. I checked some other Oberon-based compilers. This behaviour is actually documented in The Oberon Companion as follows:

How ASSERT statements are treated by the compiler

The compiler evaluates the boolean expression of ASSERT statements with the
following outcome:

- if an expression is TRUE, the ASSERT is treated as dead code
- if an expression is FALSE, an error message (99) is logged
- if an expression cannot be evaluated at compile time, the ASSERT
statement is included as a run-time check

This is the documentation for ETH Oberon System 3 which uses the same portable OP2 Oberon-2 compiler that is the basis for the Blackbox Component Pascal compiler so it is unsurprising that the behaviour is the same. I haven't found a similar explanation in the Blackbox documentation but it may be somewhere there.

Interestingly, a later version of the Oberon Language (Oberon-07) eliminated the HALT statement altogether and promotes the use of ASSERT(FALSE) instead so there is no redundancy and no ambiguity.
Posts: 44
Joined: Wed Sep 18, 2013 10:06 pm


Return to Bug

Who is online

Users browsing this forum: No registered users and 1 guest