Size of array type in Ada
<p>I'm just getting back into Ada after being away for quite a while, so this is probably a beginner question. Essentially I'm trying to print the length of a 1-dimensional array. This array is inside of a record. I can print the type fine if I make an instance of the record but I feel there must be a way to print the length from just the type alone. Here a very contrived example of some code I thought would work:</p>

<pre><code>with Ada.Text_Io;

procedure TestApp is
   type int_array is array (integer range &lt;&gt;) of integer;
   type item_type is record
      ia : int_array (0 .. 20);
   end record;
begin
   Ada.Text_Io.Put_Line(Integer'image(item_type.ia'length));
end TestApp;
</code></pre>

<p>but I get the error "Invalid prefix in selected component 'item_type'". If I instantiate item_type and get the range from that it of course works fine but I feel I must be missing something.</p>

<p>Thanks</p>