[lazarus] Better proposition for debug code.

michael at tfdec1.fys.kuleuven.ac.be michael at tfdec1.fys.kuleuven.ac.be
Wed Jul 21 09:47:18 EDT 1999




On Wed, 21 Jul 1999, Michael A. Hess wrote:

> michael at tfdec1.fys.kuleuven.ac.be wrote:
> > 
> > This is the default behaviour; if you set the procedural variable
> > 'asserterrorproc' then you can customize the behaviour; the
> > application just continues after the assertion handler.
> > 
> > careful; the systutils unit sets the handler, and turns it into an
> > exception. you must be sure that sysutils doesn't override your
> > handler. (normally, it should not)
> 
> OK guys it seems to be 6 of one, half a dozen of another. Which way do
> we go at this? The Assertion method does seem to be fairly clean. It is
> there an only compiled it when the $ASSERTION switch is turned on.
> 
> Now my question is can we monitor this switch in the code? If so then we
> can make sure that the udebug unit is also not included in the code.

Yes:

{$IFOPT C}
   Uses UDebug;
{$endif}

But this won't work if in general assertionas are off and you do somewhere 
in your code:

{$ASSERTIONS ON}

  some code

{$ASSERTIONS OFF}

Assertions is a local switch, So better to include the unit always.

Michael.






More information about the Lazarus mailing list