From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Pointer to instance of indefinite array? Date: Wed, 13 Aug 2014 21:17:08 +0300 Organization: Tidorum Ltd Message-ID: References: <892c6798-489d-400a-bb9a-7a14605c493f@googlegroups.com> <58a951df-217b-48ee-bd0b-f9953f5b622b@googlegroups.com> <53eaea2e$0$32377$862e30e2@ngroups.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net 35SVCTEMmGNOEkQEX6Yn1AYNF9fU3Ftc49skwxxPb4Timsv3wJ Cancel-Lock: sha1:DRt7HgW+GIgIu/Kbu9RysB5ovwk= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <53eaea2e$0$32377$862e30e2@ngroups.net> Xref: number.nntp.dca.giganews.com comp.lang.ada:188426 Date: 2014-08-13T21:17:08+03:00 List-Id: On 14-08-13 07:31 , Per Sandberg wrote: > Well, > The compiler uses the most appropriate method of passing parameters (by > value or by reference) depending on the kind of object, this usually > means that composite types is passed by reference and scalars is passed > by value. Anecdote: Long ago, there was an (in)famous version of GNAT (something like 2.95p, perhaps?) for which AdaCore had decided to be "more compatible with C" and therefore to pass record types by copy. I was developing an application that heavily relied on passing large records around. We ended up delivering the application with advice to use a 10 MB stack limit... a large amount, at the time. Luckily the application was not time-critical. However, this compiler "feature" also revealed an aliasing bug in the application, where one of my procedures was reading a record object passed as a parameter, while modifying it as a global (IIRC). Perhaps GNAT should have an option to use pass-by-copy wherever it can, to smoke out such bugs :-). -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .