Sign in Join
Wiki copytemporary

$Assertions: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-Back to [[local compiler directives]].
1+Back to [[local compiler directives]].
22
3-
4-The local compiler directive **$C** or **$ASSERTIONS** :
3+The local compiler directive **\$C** or **\$ASSERTIONS**:
54
6- * is used for error detection;
7- * determines whether an expression is compiled or not. If the directive is active, then the Assert expression is compiled.
5+- is used for error detection;
6+- determines whether an expression is compiled or not. If the directive is active, then the Assert expression is compiled.
87
9-Examples:
10-```
8+Examples:
9+
10+``` pascal
1111...
12- {$ASSERTIONS ON}
13- ...
14- Assert(BooleanExpression, AssertMessage);
15- ...
16-```
12+{$ASSERTIONS ON}
13+...
14+Assert(BooleanExpression, AssertMessage);
15+...
1716```
17+
18+``` pascal
1819...
19- {$C ON}
20- ...
21- Assert(BooleanExpression);
22- ...
20+{$C ON}
21+...
22+Assert(BooleanExpression);
23+...
2324```
2425
25-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.
26+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.
2627
2728## see also
2829
29- * [`$C` or `$ASSERTIONS`: Assertion support](<https://freepascal.org/docs-html/current/prog/progsu5.html>) in the Programmer’s Guide
30+- [`$C` or `$ASSERTIONS`: Assertion support](https://freepascal.org/docs-html/current/prog/progsu5.html) in the Programmer’s Guide
3031
3132---
32-*From the Free Pascal wiki, page "$Assertions", as the Internet Archive kept it. 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](/wiki-contact).*
33+*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](/wiki-contact).*

Back to history