comp.lang.ada
 help / color / mirror / Atom feed
From: Daniel Norte Moraes <danielcheagle@gmail.com>
Subject: Re: Ada Pure or Preelaborate or ? in Adare_net
Date: Wed, 5 Jan 2022 08:11:52 -0800 (PST)	[thread overview]
Message-ID: <98855f15-6bc3-4575-8a89-709175b5f7b8n@googlegroups.com> (raw)
In-Reply-To: <15ffbb15-6f0b-4f61-8740-f100d9e384bbn@googlegroups.com>

Em segunda-feira, 3 de janeiro de 2022 às 22:11:37 UTC-3, Simon Belmont escreveu:
> On Friday, December 31, 2021 at 11:13:33 AM UTC-5, daniel...@gmail.com wrote: 
> > Hi! 
> > 
> > I and a friend created an Ada network lib where, 
> > from the begining, we tried very hard to make It a Ada Pure. 
> > 
> > From the examples dir, the lib worked as expected (in gcc-10.2 gcc-11.2 and gcc-12). 
> > 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. 
> > 
> > For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary. 
> > 
> > link: https://gitlab.com/daresoft/network/adare_net/-/tree/202x 
> > for Ada version use 2012 and or 202x. 
> > 
> > Best Wishes and Happy New Year, 
> > Dani.
> It seems to be mostly just a thin binding to a bunch of C functions, so the applicability of any Ada feature is mostly a moot point. The Ada compiler 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 violate those "purity rules" all they want, which might be misleading to users expecting otherwise. You don't use 'Unchecked_Access either, but obviously that doesn't mean the C functions are somehow prevented from creating dangling pointers. Personally, I would have the interfaces reflect the reality of the actual behavior (which in the case of C code you don't control, is usually assume-the-worst). 
> 
> -sb

Thanks !

The C pointers are only created in   c_initialize_socket.c (c_init_address()  ) and data pointed copied 
to an ada array, and then immediately free by c part.  this is the only time there is a dynamic allocation. 
We managed to make libadare_net very close to 100% static allocation!
Because this, don´t 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.

  reply	other threads:[~2022-01-05 16:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 16:13 Ada Pure or Preelaborate or ? in Adare_net Daniel Norte Moraes
2022-01-04  1:11 ` Simon Belmont
2022-01-05 16:11   ` Daniel Norte Moraes [this message]
2022-01-04 13:52 ` Fabien Chouteau
2022-01-05 16:33   ` Daniel Norte Moraes
2022-01-05 23:40     ` Randy Brukardt
2022-01-06 20:39       ` Daniel Norte Moraes
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox