Ada Programming/Pragmas/Suppress


Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

Summary

edit

The pragma Suppress suppresses compiler-generated run-time checks. If a run-time check is disabled, an exception may be suppressed and undefined behavior could result. pragma Suppress is used at the programmer's risk.

Checks that may be suppressed are:

  • Access_Check - Check for dereference of a null access value. Constraint_Error suppressed.
  • Accessibility_Check - Check for access of inaccessible object or subprogram. Program_Error suppressed.
  • Discriminant_Check - Check for access of an unavailable component in a discriminant record (given the discriminant). Constraint_Error suppressed.
  • Division_Check - Checks for divide by zero. Constraint_Error suppressed.
  • Elaboration_Check - Checks for unelaborated package or subprogram body. Program_Error suppressed.
  • Index_Check - Check for out-of-range array index. Constraint_Error suppressed.
  • Length_Check - Check for array length violation. Constraint_Error suppressed.
  • Overflow_Check - Check for numeric overflow. Constraint_Error suppressed.
  • Range_Check - Check of scalar variable for out-of-range values. Constraint_Error suppressed.
  • Storage_Check - Check for sufficient storage space to accommodate subprogram call. Storage_Error suppressed.
  • Tag_Check - Checks for invalid object tag. Constraint_Error suppressed.
  • All_Checks - All the above checks

Example

edit
My_Array : Array ( 1 .. 100 ) of Integer;
pragma Suppress( Index_Check );
...
Some_Variable := My_Array( 1000 ); -- Erroneous execution, here we come!

See also

edit

Wikibook

edit

Ada Reference Manual

edit

Ada 2005 Reference Manual

edit

Ada Quality and Style Guide

edit