Ada Reference Manual (Ada 2022)Legal Information
Contents   Index   References   Search   Previous   Next 

11.1 Exception Declarations

1
An exception_declaration declares a name for an exception. 

Syntax

2/3
exception_declaration ::= defining_identifier_list : exception
   [aspect_specification];

Static Semantics

3
Each single exception_declaration declares a name for a different exception. If a generic unit includes an exception_declaration, the exception_declarations implicitly generated by different instantiations of the generic unit refer to distinct exceptions (but all have the same defining_identifier). The particular exception denoted by an exception name is determined at compilation time and is the same regardless of how many times the exception_declaration is elaborated. 
4
The predefined exceptions are the ones declared in the declaration of package Standard: Constraint_Error, Program_Error, Storage_Error, and Tasking_Error; one of them is raised when a language-defined check fails. 

Dynamic Semantics

5
The elaboration of an exception_declaration has no effect.
6/5
The execution of any construct raises Storage_Error if there is insufficient storage for that execution. The amount of storage necessary for the execution of constructs is unspecified. 

Examples

7
Examples of user-defined exception declarations: 
8
Singular : exception;
Error    : exception;
Overflow, Underflow : exception;

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe