Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

6.5.1 Nonreturning Procedures

1/3
Specifying aspect No_Return to have the value True indicates that a procedure cannot return normally; it may propagate an exception or loop forever. 
Paragraphs 2 and 3 were moved to Annex J, “Obsolescent Features”. 

Static Semantics

3.1/3
 For a procedure or generic procedure, the following language-defined representation aspect may be specified: 
3.2/3
 No_Return
The type of aspect No_Return is Boolean. When aspect No_Return is True for an entity, the entity is said to be nonreturning.
3.3/3
If directly specified, the aspect_definition shall be a static expression. This aspect is never inherited; if not directly specified, the aspect is False.
3.4/3
 If a generic procedure is nonreturning, then so are its instances. If a procedure declared within a generic unit is nonreturning, then so are the corresponding copies of that procedure in instances.

Legality Rules

4/3
Aspect No_Return shall not be specified for a null procedure nor an instance of a generic unit.
5/2
A return statement shall not apply to a nonreturning procedure or generic procedure.
6/2
A procedure shall be nonreturning if it overrides a dispatching nonreturning procedure. In addition to the places where Legality Rules normally apply (see 12.3), this rule applies also in the private part of an instance of a generic unit.
7/2
If a renaming-as-body completes a nonreturning procedure declaration, then the renamed procedure shall be nonreturning.
Paragraph 8 was deleted.

Dynamic Semantics

9/2
If the body of a nonreturning procedure completes normally, Program_Error is raised at the point of the call.

Examples

10/3
procedure Fail(Msg : String)  -- raises Fatal_Error exception
   with No_Return;
   -- Inform compiler and reader that procedure never returns normally

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