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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder4.news.weretis.net!newsfeed.tele2net.at!newsfeed.utanet.at!feeder1.cambriumusenet.nl!feed.tweaknews.nl!212.27.60.9.MISMATCH!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 25 Nov 2013 11:59:33 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How To Pass Large Object Arguments References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <52932d95$0$6558$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 25 Nov 2013 11:59:33 CET NNTP-Posting-Host: f49faf29.newsspool4.arcor-online.net X-Trace: DXC=OU;SkhU_9g@k:C4l9A;OcO4IUKejVHRkEeDe5VfhI:;ZXhl\ZSaB X-Complaints-To: usenet-abuse@arcor.de Xref: news.eternal-september.org comp.lang.ada:17781 Date: 2013-11-25T11:59:33+01:00 List-Id: On 24.11.13 08:20, FritzVonBraun wrote: > I am considering passing objects that I think are too big for a copy operation through an access parameter, but that would basically contradict the principle of problem orientation instead of machine orientation. I would really rather be able to handle these situations without having to worry about the underlying mechanism myself. Exactly. The language rules in LRM 6.2 (see Ludovic's message) make the compiler choose among the possibilities so established. In addition, some rules are AS-IF rules, so optimizers can manage parameter passing as they see fit. They do, drawing upon the compiler writers' knowledge of the architecture: If a primitive operation of a "small" tagged type has Inline applied to it, then, for example, GNAT's optimizer may drop all reference to the object when translating Object.. function Val (Object : OO_Type) return Some_Integer; pragma Inline (Val); function Val (Object : in T) return Integer is begin return Object.Data; end Val; is one example. Its translation, at -gnatn -O2, shows that record components need not be made publicly visible to address worries about mechanism. This feature of the language, i.e. making by-copy/by-reference and in/out separate concepts, removes the need for access parameters almost everywhere. And also thinking about them if not problem oriented ;-)