From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8963682ce4cab241 X-Google-Attributes: gid103376,public From: "bklungle" Subject: Re: GNAT Limitations? Date: 1998/01/25 Message-ID: <01bd296e$fad757c0$0e2915c0@p5120>#1/1 X-Deja-AN: 319084649 References: <6aesm3$sr6$1@Masala.CC.UH.EDU> Organization: B & D Associates X-NETCOM-Date: Sun Jan 25 12:44:17 AM PST 1998 Newsgroups: comp.lang.ada Date: 1998-01-25T00:44:17-08:00 List-Id: 1. Read the manual 2. Remove Ada. 3. Put the (n) where it belongs enclosed with Unchecked_Deallocation; procedure Huh is type x is record a : integer := 0; b : integer := 0; c : integer := 0; end record; type x_ptr is access x; procedure dispose is new Unchecked_Deallocation(x, x_ptr); an_x : x := (a => 1, b => 2, c => 3); type m is array(1..2, 1..3) of integer; an_m : m := (others => (others => 0)); begin for i in an_m'range(1) loop for j in an_m'range(2) loop an_m(i,j) := i; end loop; end loop; end Huh; -- and then compile linux:~/atest> touch *.adb linux:~/atest> ada huh.adb gcc -c -g huh.adb gnatbind -x huh.ali gnatlink -g huh.ali linux:~/atest> wanker@exploited.barmy.army wrote in article <6aesm3$sr6$1@Masala.CC.UH.EDU>... > Hi all, > > On GNAT 3.09 (Win95) I find two problems that I can't find mentioned > anywhere in the documentation: > 1) GNAT refuses to let me initialize a record with named > fields if I don't initialize every field. For > example: > > type X is > record > A : Integer := 1; > B : Integer := 2; > C : Integer := 3; > end record; > > A_Rec : X := (A => 5, C => 6); > > Gives me an error with something like "No value > provided for B". However, according to the > "C/C++ to Ada" Guide I am supposed to be able > to do this. What gives? > > 2) When I try to instantiate Ada.Unchecked_Deallocation, > GNAT claims that Unchecked_Deallocation is not > in Ada, which contradicts what's in the Language > Referenec Manual and the "C/C++ to Ada Guide". > Again, what gives? > > 3) GNAT refuses to compile code where I try to find the > range of a particular dimension of a multi-dimensional > array. I'm using the example in the C/C++ to > Ada Guide: > > -- Assuming Matrix is a 2d array type > > for I in Matrix(1)'Range loop > for J in Matrix(2)'Range loop > Some_Op (Matrix (I, J)); > end loop; > end loop; > > The compiler complains about using an attribute > and indexing Matrix at the same time. > > Has anyone else been having any of the above problems? If so, > is there some kind of workaround? > > >