Sign in Join
Wiki copytemporary

$Assertions

Deutsch · English

Back to local compiler directives.

The local compiler directive $C or $ASSERTIONS:

Examples:

pascal
...
{$ASSERTIONS ON} 
...
Assert(BooleanExpression, AssertMessage);
...
pascal
...
{$C ON} 
...
Assert(BooleanExpression);
...

If the BooleanExpression is false, an optional error message (AssertMessage) is output with the file name, the line number and the address and the program aborts with Runtime error 227. If BooleanExpression is true, program execution continues normally. If assertions are not enabled at compile time, the Assert routine does nothing, and no code is generated for the Assert call.

see also


From the Free Pascal wiki, page "$Assertions", as it stood on 2021-02-11 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Edited on wiki.freepascal.org by 2 people, 2020–2021

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
TrevEnglish translation of German page
TrevFix typo (minor)
TrevTrev moved page sAssertions to $Assertions: Dollar signs in page titles are ok (minor)
Kai Burghardtadd see also: to PG

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.