This is the mail archive of the dwarf2@corp.sgi.com mailing list for the dwarf2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Ada example in Figures 48 & 49: one more correction


Ron:

   One more thing I forgot to mention in my last mail.  The type of rec2 in
   Figure 48 is called "indefinite".  (A subtype is indefinite if it's an
   unconstrained array, or any other type with either unknown discriminants
   or unconstrained discriminants without defaults.)  That means you can't
   declare an object of it like obj2b.  Ada 83 had similar rules, but worded
   differently.

   There are a number of fixes:

      1) give the discriminant "n" a default value

            type rec2 (n : teeny := 100) is ...

      2) give obj2b's type a constraint:

            obj2b : rec2(100);

      3) give obj2b an initial value (from which it derives the constraint
         for the "actual subtype"):

            obj2b : rec2 := <exp>;

-- 
Todd Allen
Concurrent Computer Corporation


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]