home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!network.ucsd.edu!news!nosc!dale.cts.com!jhb
- From: jhb@dale.cts.com (John Bollenbacher)
- Subject: null arrays
- Message-ID: <BxvtCA.LM1@dale.cts.com>
- Sender: news@dale.cts.com (USENET News Account)
- Organization: Titan Linkabit Corporation
- X-Newsreader: Tin 1.1 PL5
- Date: Tue, 17 Nov 1992 22:33:46 GMT
- Lines: 40
-
- Can somebody shed some light on the symptoms of the following program. In
- short, under circumstances I cannot completely understand, when assigning
- the contents of a null array to the field of a variant record, I get a
- constraint error. As the example shows, I can sometimes assign from a null
- array, but not always.
-
- I know it looks strange in this form. It arose in a procedure whose job it
- was to remove the last element from such an object. For what it's worth,
- I am using Alsys v4.4 DOS386 compiler. Any insights would be appreciated.
-
- -------------------cut here-----------------------------------------------
- procedure TEST is
-
- subtype T is NATURAL range 0 .. 10;
-
- type ARR is array (T range <>) of BOOLEAN;
-
- type A(N : T := 0) is record
- DATA : ARR(1..N);
- end record;
- I : INTEGER;
- O : A := (3, (TRUE, FALSE, TRUE));
-
- N1 : constant ARR := O.DATA(1..0) & O.DATA(1..0);
- N2 : constant ARR := O.DATA(1..0) & O.DATA(3..2);
- begin
- I := N1'LENGTH; -- I = 0
- I := N2'LENGTH; -- I = 0
- O := (0, N1); -- does not raise constraint
- O := (0, N2); -- raises constraint
- end TEST;
-
-
- --
- -----------------------------------------------------------------------------
- - John Bollenbacher jhb@dale.cts.com -
- - Titan Linkabit Corp. (619) 552-9963 -
- - 3033 Sience Park Rd. -
- - San Diego, Ca. 92121 -
- -----------------------------------------------------------------------------
-