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.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.4 X-Received: by 10.36.135.71 with SMTP id f68mr4057551ite.40.1511968621575; Wed, 29 Nov 2017 07:17:01 -0800 (PST) X-Received: by 10.157.83.199 with SMTP id i7mr70715oth.3.1511968621352; Wed, 29 Nov 2017 07:17:01 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!193no741623itr.0!news-out.google.com!193ni1111iti.0!nntp.google.com!i6no746402itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 29 Nov 2017 07:17:01 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.154.190.101; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 82.154.190.101 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: simple code can't compiled, without clear compiler warning (not clear enough to me at least) From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Wed, 29 Nov 2017 15:17:01 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49246 Date: 2017-11-29T07:17:01-08:00 List-Id: I am learning and training through the Aix en Provence Ada courses. I coded for the first time things more substantial than reading or writing strings. Neither the specification or the body can compile, and I can't see why. generic type Element_type is (<>); type Indice_type is (<>); type Tableau_type is array (Indice_type range <>) of Element_type; package Tri_selection is procedure tri (T: in out Tableau_type); end Tri_selection; $ gcc-6 -c tri_selection.ads cannot generate code for file tri_selection.ads (package spec) gnatmake: "tri_selection.ads" compilation error I thought specifications could be compiled separately ? the body can't compiled either. package body Tri_selection is temp : Element_type; procedure tri (T: in out Tableau_type) is procedure Swap (T: in out Tableau_type; A, B : in out Element_type) is temp: Element_type; begin temp := T(A); T(A) := T(B); T(B) := T(A); end Swap; temp: Indice_type; begin for I in Tableau_type'Range loop for J in I..Tableau_type'Last loop if T(J) < T(Tableau_type'Last) then temp := J; end if; end loop; Swap (T,temp,Tableau_type'Last); end loop; end tri; end Tri_selection; mehdi@debian:~/essai$ gnatmake tri_selection.adb gcc-6 -c tri_selection.adb tri_selection.adb:7:35: expected type "Indice_type" defined at tri_selection.ads:3 tri_selection.adb:7:35: found type "Element_type" defined at tri_selection.ads:2 tri_selection.adb:8:27: expected type "Indice_type" defined at tri_selection.ads:3 tri_selection.adb:8:27: found type "Element_type" defined at tri_selection.ads:2 tri_selection.adb:8:35: expected type "Indice_type" defined at tri_selection.ads:3 tri_selection.adb:8:35: found type "Element_type" defined at tri_selection.ads:2 tri_selection.adb:9:27: expected type "Indice_type" defined at tri_selection.ads:3 tri_selection.adb:9:27: found type "Element_type" defined at tri_selection.ads:2 tri_selection.adb:9:35: expected type "Indice_type" defined at tri_selection.ads:3 tri_selection.adb:9:35: found type "Element_type" defined at tri_selection.ads:2 tri_selection.adb:19:33: expected type "Element_type" defined at tri_selection.ads:2 tri_selection.adb:19:33: found type "Indice_type" defined at tri_selection.ads:3 gnatmake: "tri_selection.adb" compilation error