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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,18352ac39491e701 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.104 with SMTP id gp8mr17949090pbc.4.1340746782837; Tue, 26 Jun 2012 14:39:42 -0700 (PDT) Path: l9ni23358pbj.0!nntp.google.com!news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Why this error, value not in range of subtype of "Standard.Integer"? Date: Tue, 26 Jun 2012 17:39:42 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1340746782 12547 192.74.137.71 (26 Jun 2012 21:39:42 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 26 Jun 2012 21:39:42 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:px+oPIiuMYTn04IOlcPlonKeWoY= Content-Type: text/plain; charset=us-ascii Date: 2012-06-26T17:39:42-04:00 List-Id: "Nasser M. Abbasi" writes: > If I write this, I get an error as show: (notice the B > matrix declaration, that is where the problem is) > > -------------- this does not work ------ > with Ada.Numerics.Real_Arrays; use Ada.Numerics.Real_Arrays; > > procedure foo2 is > A : constant Real_Matrix := > (( 1.0, 2.0, 3.0), > ( 4.0, 5.0, 6.0), > ( 7.0, 8.0, 9.0)); > B : Real_Matrix(1 .. 3,1 .. 3); -- this is the problem Others answered your question, but: You might find it convenient to declare a subtype: subtype My_Real_Matrix is Real_Matrix(1..3, 1..3); A: constant My_Real_Matrix := ((1.0, .... B: My_Real_Matrix; Also look into the "for ... of" syntax of Ada 2012. - Bob