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,dc1fff2721602dfa X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.66.72.227 with SMTP id g3mr1756238pav.31.1359770111413; Fri, 01 Feb 2013 17:55:11 -0800 (PST) Path: s9ni29935pbb.0!nntp.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ada and string literals References: <4978d638-a04b-4561-85e9-cf6620265af2@googlegroups.com> <86boc63n5d.fsf@gaheris.avalon.lan> Date: Fri, 01 Feb 2013 20:55:06 -0500 Message-ID: <85d2wj1nut.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (windows-nt) Cancel-Lock: sha1:Nu14B83HG9Wmd81pSQw2ZmjlxCk= MIME-Version: 1.0 X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 333a6510c71ffc55ab71417383 X-Received-Bytes: 1318 Content-Type: text/plain Date: 2013-02-01T20:55:06-05:00 List-Id: codeallergy writes: > another question: how free a object from a procedure ? > > example: > procedure Free_Abc (Target : access String) > is > begin > GNAT.Strings.Free(Target); -- error > end Free_Abc; > > this code produce the error: actual for "X" must be a variable > > why disallow that ? Because Free sets its argument to null, which it can't do if it's not a variable. Setting the argument to null helps avoid dangling pointers. -- -- Stephe