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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.18.138 with SMTP id 10mr5974392ios.70.1521471097640; Mon, 19 Mar 2018 07:51:37 -0700 (PDT) X-Received: by 2002:a9d:109:: with SMTP id 9-v6mr767975otu.8.1521471097493; Mon, 19 Mar 2018 07:51:37 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!maths.tcd.ie!newsswitch.lcs.mit.edu!ottix-news.ottix.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!r195-v6no2495759itc.0!news-out.google.com!h73-v6ni5158itb.0!nntp.google.com!r195-v6no2495755itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 19 Mar 2018 07:51:37 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2003:c7:83e8:db87:a4e8:ce22:1fc6:acb8; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 2003:c7:83e8:db87:a4e8:ce22:1fc6:acb8 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9aac5f89-e38b-4246-9a5f-8a99bf9a1a38@googlegroups.com> Subject: Re: little precision about anonymous access types From: AdaMagica Injection-Date: Mon, 19 Mar 2018 14:51:37 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:51068 Date: 2018-03-19T07:51:37-07:00 List-Id: Am Montag, 19. M=C3=A4rz 2018 02:18:34 UTC+1 schrieb Mehdi Saada: > At last, I would like to know what happens exactly when one tries to deal= locate a pointer, referencing a variable *on the stack* ? This is erroneous. See in the RM what erroneous means. Also note that deallocation of an object allocated via new is erroneous whe= n done with a different access type than was used to allocate the object. Do never ever allocate with anonymous access types. (Exception: coextensions - which some Ada aficionados consider a bad mistak= e.) I do not know where such an object is allocated, so I cannot tell what happ= ens when you convert to a named access type: declare type A_TYPE is access all INTEGER; A : A_TYPE; begin declare B: access INTEGER :=3D new INTEGER'(7); begin A :=3D A_TYPE(B); end; end;