From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: 'address on a subprogram parameter Date: Sat, 24 Apr 2021 12:56:23 +0300 Organization: Tidorum Ltd Message-ID: References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com> <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com> <07a090e1-85b4-4ebb-a093-dcda57b56579n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net m8mMPrUUMqwxEYF2cIQ+kQdLw7EwSOt1O+eaBDo0nctQgErcOh Cancel-Lock: sha1:7KPoH9V6AFNlPrOLCjXRULPQ8sg= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61905 List-Id: On 2021-04-24 4:25, Randy Brukardt wrote: > "Vincent Marciante" 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.