$Assertions Compiler Directive
$C
or $Assertions
enables or disables the
Assert
procedure. When enabled (the default), the
compiler generates code to test assertions. When disabled, the
compiler ignores all calls to the Assert
procedure
and does not generate any code for them.
A common misconception is that assertions are primarily for debugging, and that they should be disabled for release. Assertions ensure the proper functioning of your program. If an assertion fails, that means the state of your program is different from anything you anticipated. If the program were to continue running, its behavior would be completely unpredictable. The results might include corruption of the user’s data or other dire consequences. It is better to report the assertion violation and terminate the program.
If an assertion in an inner loop causes performance problems, you can
disable just that assertion by using conditional compilation with the
$Assertions
compiler directive.