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=-0.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLYTO_END_DIGIT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,20df27b13b7ee81e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-19 20:30:00 PST From: Patrick Hohmeyer Subject: Re: Beginner: Unchecked Deallocation Newsgroups: comp.lang.ada Reply-To: pi3_1415926536@yahoo.ca References: <2d87db3f.0112180600.6129c36b@posting.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8Bit User-Agent: KNode/0.3.2 Message-ID: Date: Wed, 19 Dec 2001 23:39:15 -0500 NNTP-Posting-Host: 65.94.190.113 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1008821668 65.94.190.113 (Wed, 19 Dec 2001 23:14:28 EST) NNTP-Posting-Date: Wed, 19 Dec 2001 23:14:28 EST Organization: Bell Sympatico Path: archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news1.tor.metronet.ca!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Xref: archiver1.google.com comp.lang.ada:18131 Date: 2001-12-19T23:39:15-05:00 List-Id: Antoine Lec. wrote : > > Procedure free declared in the spec is parameterless. The procedure > > free instantiated in the body takes an in out parameter of type > > liste_acs! > > > There is another problem when I change the definitions with this one : > > lcm.ads: > procedure Free (LS: in out Liste_Acs); > > lcm.adb > procedure Free (LS: in out Liste_Acs) is > new Ada.Unchecked_Deallocation (Liste, Liste_Acs); > > This results with: > > procedure Free (LS: in out Liste_Acs) is > | > >>> formal part not allowed in instantiation > > So what's the problem ? > You have to write lcm.ads: procedure Free (LS: in out Liste_Acs); and lcm.adb procedure Free is new Ada.Unchecked_Deallocation (Liste, Liste_Acs); But WHY the heck do you put Free in the ads anyway? Do you really want the main procedure to dangle with the lists pointers? Thumb rule : nothing that directly manipulates pointers in an ads. Just hide it in the adb. (Unless you have a very good reason why not) -- Patrick Hohmeyer