From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:622a:1986:b0:343:225d:f9e1 with SMTP id u6-20020a05622a198600b00343225df9e1mr13530684qtc.651.1661118542588; Sun, 21 Aug 2022 14:49:02 -0700 (PDT) X-Received: by 2002:a0d:cdc2:0:b0:335:debd:2b3d with SMTP id p185-20020a0dcdc2000000b00335debd2b3dmr16903883ywd.19.1661118542407; Sun, 21 Aug 2022 14:49:02 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 21 Aug 2022 14:49:02 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=187.106.43.228; posting-account=wgmHdgoAAAA-F7JItPEZjeXqFc0KdzEQ NNTP-Posting-Host: 187.106.43.228 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1d93145f-7da3-4a02-b0f7-5ae5c38dedb4n@googlegroups.com> Subject: Re: About procedures and functions in Ada Pure packages. Thanks! From: Daniel Norte Moraes Injection-Date: Sun, 21 Aug 2022 21:49:02 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:64210 List-Id: Em quarta-feira, 17 de agosto de 2022 =C3=A0s 22:12:24 UTC-3, Randy Brukard= t escreveu: > "Daniel Norte Moraes" wrote in message=20 > news:e1f43654-dba6-46d7...@googlegroups.com... > > Hi! and Very Very Very Thanks!=20 > >=20 > > I building and change some packages and I have some doubts=20 > > about procedures and functions in Ada Pure packages.=20 > > I'm asking mainly the Ada Language Lawers. the Ada version is Ada2012.= =20 > >=20 > > fact 1: Ada allow the compiler substitute a function with=20 > > the result of this function.=20 > >=20 > > ?This is valid to functions with 'in out' or 'out' parameters ?=20 > > ?This is valid to functions with 'not null access' parameters ?=20 > > ?This is valid to procedures with 'in out' or 'out' parameters ?=20 > > ?This is valid to procedures with 'not null access' parameters ? > Yes, but there is a requirement that the input *values* are the same on b= oth=20 > calls, and in the case of access types, everything reachable is the same = on=20 > both calls. See 10.2.1(18/3) --=20 > http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-10-2-1.html#p18=20 >=20 > Practically, compilers will exclude some or all of these cases. > > ?If they are replaced (on the second call onwards) by the result,=20 > > will the 'in' 'in out' and 'not null access' parameters be updated=20 > > if they are changed within the function or procedure? > If the "in out" parameters are changed, then the values don't match on th= e=20 > second call, and the optimization isn't allowed. If the values are change= d=20 > to the *same* value as original, the optimization would be allowed, but y= ou=20 > couldn't tell whether or not the values were changed, so I think the=20 > question is moot in that case.=20 >=20 > Again, I doubt that an actual compiler would try to optimize in such case= s=20 > (too hard to prove that they're OK).=20 >=20 > Randy. Thanks Randy! I'm satisfied. Very Very Very GrateFull, Best Wishes, Dani.