home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!sun-barr!cs.utexas.edu!torn!cunews!dgbt!netfs!news
- From: BERRYMAN@orca.drep.dnd.ca (DON BERRYMAN)
- Subject: Variant Record Defaults
- Message-ID: <1992Sep2.223807.9217@netfs.dnd.ca>
- Sender: news@netfs.dnd.ca (NEWS)
- Nntp-Posting-Host: orca.drep.dnd.ca
- Organization: Defence Research Establishment Pacific
- Date: Wed, 2 Sep 1992 22:38:07 GMT
- X-News-Reader: VMS NEWS 1.20
- Lines: 54
-
-
- Please concider the following code fragment:
-
- package dstring is
- type text (maxlen: positive := 64) is private;
- ---STUFF DELETED--
- private
- type text (maxlen: positive := 64) is
- record
- last: natural := 0;
- data: string (1..maxlen);
- end record;
- end dstring;
-
- with dstring;
- procedure useit is
- type buffer is record
- data: dstring.text;
- end record;
- aaa: buffer;
- bbb: dstring.text;
- begin
- null;
- end useit;
-
-
- When compiled on VAX/VMS Ada I get the following:
-
- S2$ ada useit
- 3 type buffer is record
- ...........1
- %ADAC-I-CONS_OR_NUM_ERR, (1) CONSTRAINT_ERROR or NUMERIC_ERROR will be raised
- here [LRM 11.1(5-6), F.9.5]
- during evaluation related to record type buffer at line 3
- %ADAC-I-ENDDIAGS, Ada compilation completed with 1 diagnostic
- S2$
-
- What appears to be the problem is that BUFFER.DATA is not using the default
- for MAXLEN. When I specify it in the record definition the message goes
- away. Since I can create the variable, BBB, of type DSTRING.TEXT it does not
- seem to be a problem with my definitions. So why does ADA not use the
- default for BUFFER.DATA???
-
- I'm sure the reason is given in an obscure section of the LRM,
-
-
- Don Berryman
- Defence Research Establishment Pacific
- Canadian Forces Base Esquimalt
- Victoria, BC, CANADA, V0S-1B0
- 604-363-2731 604-363-2856fax
- berryman@orca.drep.dnd.ca
-
-
-