TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"David C. Hoos, Sr." <[log in to unmask]>
Reply To:
David C. Hoos, Sr.
Thu, 4 Feb 1999 04:40:03 -0600
text/plain (40 lines)
-----Original Message-----
From: Rick Duley <[log in to unmask]>
To: [log in to unmask] <[log in to unmask]>
Date: Thursday, February 04, 1999 2:47 AM
Subject: Problems with unconstrained arrays

>Hi Teamers,
>        Here is a couple of bits of bother with unconstrained arrays which I have
>been able to resolve neither through the study of the Ada95 LRM, the
>Rationale nor yet any of the texts in our library.
>1.   It doesn't appear to be possible to compile the declaration of an
>unconstrained type as either private or limited private.  I haven't been
>able to find a prohibition of this in the LRM.  Is this a compiler problem
>(GNAT 3.1)?
>2.   Try as I might I can't find a way to define a null constant of an
>unconstrained array type  -  I expected the syntax to run something like
>procedure Trial is
>   type Case_Type  is (Open, Shut);
>   type Court_Type is array(Positive range<>) of Case_Type;
>   Always_Guilty : constant Court_Type := Court_Type(2 .. 1);

You have to specify a value for the array elements that aren't going to be there! It has to be done like

procedure Trial is

   type Case_Type  is (Open, Shut);
   type Court_Type is array (Positive range <>) of Case_Type;

   Always_Guilty : constant Court_Type := (1 .. 0 => Shut);
end Trial;