comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: How To Pass Large Object Arguments
Date: Mon, 25 Nov 2013 11:59:33 +0100
Date: 2013-11-25T11:59:33+01:00	[thread overview]
Message-ID: <52932d95$0$6558$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <sqadnfc3IfFSNQzPnZ2dnUVZ_jydnZ2d@giganews.com>

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.<primitive operation>.

    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 ;-)

  parent reply	other threads:[~2013-11-25 10:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24  7:20 How To Pass Large Object Arguments FritzVonBraun
2013-11-24 11:12 ` Ludovic Brenta
2013-11-24 12:45 ` Peter C. Chapin
2013-11-25 10:59 ` Georg Bauhaus [this message]
2013-11-25 11:09 ` AdaMagica
2013-11-25 16:53 ` adambeneschan
2013-11-25 17:05   ` sbelmont700
replies disabled

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