Next: , Previous: Anonymous_Arrays, Up: Predefined Rules


23.6.3 Anonymous_Subtypes

Flag all uses of anonymous subtypes. A use of an anonymous subtype is any instance of a subtype indication with a constraint, other than one that occurs immediately within a subtype declaration. Any use of a range other than as a constraint used immediately within a subtype declaration is considered as an anonymous subtype.

An effect of this rule is that for loops such as the following are flagged (since 1..N is formally a “range”):

     for I in 1 .. N loop
        ...
     end loop;

Declaring an explicit subtype solves the problem:

     subtype S is Integer range 1..N;
     ...
     for I in S loop
        ...
     end loop;

This rule has no parameters.