comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: 'address on a subprogram parameter
Date: Sat, 24 Apr 2021 12:56:23 +0300	[thread overview]
Message-ID: <iei8a8Fk652U1@mid.individual.net> (raw)
In-Reply-To: <s5vs2o$m5t$1@franka.jacob-sparre.dk>

On 2021-04-24 4:25, Randy Brukardt wrote:
> "Vincent Marciante" <vincent.marciante@l3harris.com> wrote in message
> news:07a090e1-85b4-4ebb-a093-dcda57b56579n@googlegroups.com...
>> Got it (and "no way" that the big record that is in the real code would be
>> passed by copy
>> but I'll see if specifying it explicitly would not be disruptive).  Thanks.
> 
> Careful about assumptions, if you want the code to be portable.


Seconded.

Long ago I was working with early "public" GNAT versions ("gnatp") on a 
certain program. After we upgraded to the next version of gnatp (I think 
around version 3.12) our program started failing with Storage_Error. 
Turned out that the GNAT developers had decided that this gnatp version 
would pass all record-type parameters by value, "to be more like C" 
(IIRC Robert Dewar was said to be the origin of that idea, but that may 
be a calumny). And our program had some large record types.

We ended up shipping the program with the advice to use a 10 MiB stack 
allocation -- but it worked (it did not have any real-time requirements).

As a positive, the value-passing gnatp version made us discover a couple 
of unintended parameter-vs-global aliasing issues that had been hidden 
when all records were passed by reference.

The very next gnatp version returned to pass-by-reference for 
record-type objects. It seems there had been some negative user 
feed-back :-)


> At one point, Janus/Ada would pass pretty anything by copy to 
> parameters of certain generic types. (We got rid of that in the Ada
> 95 version because of the need to deal with "aliased" components, but
> the cost is that one needs to use a thunk to access anything of most
> generic formal types in a generic body. [Janus/Ada still uses
> universal generic sharing.])
>                                     Randy.

  reply	other threads:[~2021-04-24  9:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 15:10 'address on a subprogram parameter Vincent Marciante
2021-04-20 15:52 ` AdaMagica
2021-04-20 17:32   ` Jeffrey R. Carter
2021-04-21  9:19     ` AdaMagica
2021-04-20 17:33   ` Niklas Holsti
2021-04-20 16:35 ` J-P. Rosen
2021-04-20 17:18   ` Vincent Marciante
2021-04-20 19:25     ` Randy Brukardt
2021-04-20 19:41       ` Vincent Marciante
2021-04-24  1:25         ` Randy Brukardt
2021-04-24  9:56           ` Niklas Holsti [this message]
2021-04-21 20:17     ` Shark8
2021-04-22  9:54       ` Vincent Marciante
replies disabled

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