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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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: "Ed Colbert" Subject: Re: GNAT Limitations? Date: 1998/02/18 Message-ID: <6cf3hc$4np$1@cronkite.sp.trw.com>#1/1 X-Deja-AN: 326270995 References: <6aesm3$sr6$1@Masala.CC.UH.EDU> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: TRW, Inc. Newsgroups: comp.lang.ada Date: 1998-02-18T00:00:00+00:00 List-Id: wanker@exploited.barmy.army wrote in message <6aesm3$sr6$1@Masala.CC.UH.EDU>... >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? The problem is your aggregate does not specify a value for B. An aggregate must have an explicit value for each record component. Defaults apply to object declarations, i.e. when you declare an uninitialized object. So if you had declared: A_Rec: X; You would get default values for A, B, & C. > 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? Did you with it before you instatiated it? For example: with Ada.Unchecked_Deallocation; procedure Free is new Ada.Unchecked_Deallocation (...); > 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. You have the syntax wrong. Change your loop to the following: for I in Matrix'Range(1) loop for J in Matrix'Range(2) loop Some_Op (Matrix (I, J)); end loop; end loop; Take Care, Ed Colbert