Conditional compilation using IF const THEN
Also I believe that Prof. Wirth mentions somewhere a comment by Tony Hoare that C-style conditional compilation of the form #if DEBUG / ... / #endif is like learning to swim in a pool with flotation assistance and then abandoning it the first time you swim in the sea! :)
Never heard that comparison… not surprised though that Tony said that.
It's certainly bad practice to be intentionally debugging a different program than the one you intend to ship to customers, although it's often done.
I usually quickly insert write statements to print out the value of variables if I need to (and remove them when done debugging), usually using module Out, in order to avoid importing Texts and Oberon and opening a Texts.Writer at the beginning of my module. PS: I recall having been asked why I did not insert debug code in a kernel that we had to write for Modula-2-Extended (MEX) during a semester project presentation at EPFL, and my response was: “un noyeau ne se plante pas” (a Kernel never crashes). That remark knocked my grade off from 10 to 9... so here we go.
participants (1)
-
Andreas Pirklbauer