[fpc-pascal] Assert (in System) overhead

Tom Verhoeff T.Verhoeff at tue.nl
Sun Apr 3 21:41:11 CEST 2005


The System Unit provides the Assert procedures.  Code generation for
Assert can be activated through a compiler switch or command-line option:

	<http://www.freepascal.org/docs-html/rtl/system/assert.html>

However, if you do leave them in, what is the overhead?  In particular,

  (1)  does the generated code always involve a procedure call,
       or is the condition check inlined, and 

  (2)  is the (optional) message parameter (when present) always evaluated,
       or only when the condition fails?

>From the generated assembler listing of a small example, I get the
impression that the check is inlined and the message parameter is
evaluated only on failure.

Can someone confirm that this is indeed always the way it is handled?

	Tom
-- 
E-MAIL: T.Verhoeff @ TUE.NL     | Fac. of Math. & Computing Science
PHONE:  +31 40 247 41 25        | Eindhoven University of Technology
FAX:    +31 40 247 54 04        | PO Box 513, NL-5600 MB Eindhoven
http://www.win.tue.nl/~wstomv/  | The Netherlands




More information about the fpc-pascal mailing list