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-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ad4:5dc8:: with SMTP id m8mr50412480qvh.71.1641399112493; Wed, 05 Jan 2022 08:11:52 -0800 (PST) X-Received: by 2002:a25:ba05:: with SMTP id t5mr70633728ybg.675.1641399112316; Wed, 05 Jan 2022 08:11:52 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.misty.com!border2.nntp.dca1.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: Wed, 5 Jan 2022 08:11:52 -0800 (PST) In-Reply-To: <15ffbb15-6f0b-4f61-8740-f100d9e384bbn@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=2804:14c:4c1:8775:352d:ffd4:3db5:6282; posting-account=wgmHdgoAAAA-F7JItPEZjeXqFc0KdzEQ NNTP-Posting-Host: 2804:14c:4c1:8775:352d:ffd4:3db5:6282 References: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com> <15ffbb15-6f0b-4f61-8740-f100d9e384bbn@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <98855f15-6bc3-4575-8a89-709175b5f7b8n@googlegroups.com> Subject: Re: Ada Pure or Preelaborate or ? in Adare_net From: Daniel Norte Moraes Injection-Date: Wed, 05 Jan 2022 16:11:52 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:63343 List-Id: Em segunda-feira, 3 de janeiro de 2022 =C3=A0s 22:11:37 UTC-3, Simon Belmon= t escreveu: > On Friday, December 31, 2021 at 11:13:33 AM UTC-5, daniel...@gmail.com wr= ote:=20 > > Hi!=20 > >=20 > > I and a friend created an Ada network lib where,=20 > > from the begining, we tried very hard to make It a Ada Pure.=20 > >=20 > > From the examples dir, the lib worked as expected (in gcc-10.2 gcc-11.2= and gcc-12).=20 > > To our surprise, what most caught the attention of the group's friends = was the fact that the lib was Ada Pure and if that was correct.=20 > >=20 > > For this reason, if really 'is' pure, not pure, preelaborate or what (?= ), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze a= nd suggest modifications if necessary.=20 > >=20 > > link: https://gitlab.com/daresoft/network/adare_net/-/tree/202x=20 > > for Ada version use 2012 and or 202x.=20 > >=20 > > Best Wishes and Happy New Year,=20 > > Dani. > It seems to be mostly just a thin binding to a bunch of C functions, so t= he applicability of any Ada feature is mostly a moot point. The Ada compile= r has no control or visibility into the C domain, so while on the one hand = your packages are technically Pure, on the other hand the C functions can v= iolate those "purity rules" all they want, which might be misleading to use= rs expecting otherwise. You don't use 'Unchecked_Access either, but obvious= ly that doesn't mean the C functions are somehow prevented from creating da= ngling pointers. Personally, I would have the interfaces reflect the realit= y of the actual behavior (which in the case of C code you don't control, is= usually assume-the-worst).=20 >=20 > -sb Thanks ! The C pointers are only created in c_initialize_socket.c (c_init_address(= ) ) and data pointed copied=20 to an ada array, and then immediately free by c part. this is the only tim= e there is a dynamic allocation.=20 We managed to make libadare_net very close to 100% static allocation! Because this, don=C2=B4t are dangling pointers. There is still the problem of omitting the execution of subprograms by the = compiler by pure packages. would 'preelaborate' solve this? Thanks! Best Wishes, Dani.