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,26e047a7a0709881 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 gp8mr17489427pbc.4.1341712031465; Sat, 07 Jul 2012 18:47:11 -0700 (PDT) Path: l9ni11086pbj.0!nntp.google.com!news2.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: How to initialize a matrix of one column only? Date: Sat, 07 Jul 2012 21:47:09 -0400 Organization: The Wasteland Message-ID: References: NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Date: 2012-07-07T21:47:09-04:00 List-Id: In article , "Nasser M. Abbasi" wrote: [...] > Here is the code, I write > > ---------------------- > with Interfaces.Fortran; > use Interfaces.Fortran; > with lbase; > .... > N: Fortran_Integer := 3; > B: labase.Fortran_Real_Matrix ( 1..N, 1..1 ); > BEGIN > B := ((9.0) , -- here is the problem > (2.0) , > (-2.0)); > .... > -------------------------------------------- > > where the labase package simply introduces a type for > Fortran_Real_Matrix as follows > > ---------------------------- > type Fortran_Real_Matrix is array (Fortran_Integer range <>, > Fortran_Integer range <>) > of Real; > pragma Convention (Fortran, Fortran_Real_Matrix); > -------------------- > > > >gnatmake -I../ada lap42.adb > gcc -c -I../ada lap42.adb > lap42.adb:35:16: nested array aggregate expected > lap42.adb:35:16: if single-component aggregate is intended, write e.g. (1 => > ...) > gnatmake: "lap42.adb" compilation error > > > > I tried B:=(1=>9.0,2=>2.03=>-2.0); > and B := ((9.0 ,2.0 , 3)); > but non working. > > What is the correct syntax to use? According to 4.3.3 Array Aggregates, you need to use named notation for a single component, otherwise "a single expression in parentheses is interpreted as a parenthesized expression." B := ((1 => 9.0), (1 => 2.0), (1 => -2.0)); -- John B. Matthews trashgod at gmail dot com