comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: 'address on a subprogram parameter
Date: Tue, 20 Apr 2021 14:25:22 -0500	[thread overview]
Message-ID: <s5n9r3$crn$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]

"Vincent Marciante" <vincent.marciante@l3harris.com> wrote in message 
news:13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com...
On Tuesday, April 20, 2021 at 12:35:07 PM UTC-4, J-P. Rosen wrote:
> Le 20/04/2021 à 17:10, Vincent Marciante a écrit :
> > I think that I used to know this but currently am not sure:
> >
> > Assuming the a value is passed by reference,

You can only assume that for by-reference types (see RM 6.3(4-9)).

Your example just used an unspecified record type. For any old record type 
(not in that list), the parameter passing mechanism is unspecified. Which 
means a compiler can pass by copy if it wants (it *probably* will pass by 
reference, but that's not the same as being required to do so). And if it 
does, your assumption doesn't hold.

For instance, for a small record like:
    type Screen_Position is
       X, Y : System.Byte; -- A Janus/Adaism, but I think you get the point.
    end record;
it might make more sense to pass by copy (especially if registers are used 
in the usual calling convention).

                    Randy. 


  reply	other threads:[~2021-04-20 19:25 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 [this message]
2021-04-20 19:41       ` Vincent Marciante
2021-04-24  1:25         ` Randy Brukardt
2021-04-24  9:56           ` Niklas Holsti
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