This is the mail archive of the
dwarf2@corp.sgi.com
mailing list for the dwarf2 project.
Ada example in Figures 48 & 49: one more correction
- To: dwarf2 at corp dot sgi dot com (dwarf2)
- Subject: Ada example in Figures 48 & 49: one more correction
- From: todd dot allen at ccur dot com (Todd Allen)
- Date: Wed, 7 Mar 2001 10:52:18 -0700 (MST)
- Reply-To: todd dot allen at ccur dot com (Todd Allen)
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