[Oberon] Conditional compilation using IF const THEN

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Sun Aug 12 16:16:40 CEST 2018


   > I know the *system* is not the same, but at least your compiled code is.
   > The overhead of the empty call and return is pretty low, at least in
   > a non-cached system. :)

As a further refinement, one could reduce the “overhead" down
to a single function call in the IF itself:

   IF Out.Debug() THEN  … debug code …  END

instead of

   IF debug THEN  … debug code …  END

Of course, the debug code is still sitting there, as are the strings
used by it, but it is never executed if Out.Debug() returns FALSE;
which one can achieve by replacing the (dynamically-loaded)
Out module with a stub version in production..

The purist will of course not be satisfied with all these
shenanigans discussed here.

Apart from compiler directives (which one can have different
opinions about - see Tony Hoare’s comment), I don’t know
of any truly satisfactory and/or “clean” solution to this.





More information about the Oberon mailing list