Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

What we anticipate seldom occurs; what we least expect generally happens. -- Bengamin Disraeli


devel / comp.lang.ada / 'address on a subprogram parameter

SubjectAuthor
* 'address on a subprogram parameterVincent Marciante
+* Re: 'address on a subprogram parameterAdaMagica
|+* Re: 'address on a subprogram parameterJeffrey R. Carter
||`- Re: 'address on a subprogram parameterAdaMagica
|`- Re: 'address on a subprogram parameterNiklas Holsti
`* Re: 'address on a subprogram parameterJ-P. Rosen
 `* Re: 'address on a subprogram parameterVincent Marciante
  +* Re: 'address on a subprogram parameterRandy Brukardt
  |`* Re: 'address on a subprogram parameterVincent Marciante
  | `* Re: 'address on a subprogram parameterRandy Brukardt
  |  `- Re: 'address on a subprogram parameterNiklas Holsti
  `* Re: 'address on a subprogram parameterShark8
   `- Re: 'address on a subprogram parameterVincent Marciante

1
'address on a subprogram parameter

<962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5066&group=comp.lang.ada#5066

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:a909:: with SMTP id s9mr5013214qke.225.1618931430158;
Tue, 20 Apr 2021 08:10:30 -0700 (PDT)
X-Received: by 2002:a25:ccc1:: with SMTP id l184mr25530298ybf.165.1618931429931;
Tue, 20 Apr 2021 08:10:29 -0700 (PDT)
Newsgroups: comp.lang.ada
Date: Tue, 20 Apr 2021 08:10:29 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=35.245.252.196; posting-account=XfA3zgkAAABoz6fRf3Tehtnqqr7Ycml-
NNTP-Posting-Host: 35.245.252.196
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
Subject: 'address on a subprogram parameter
From: vincent....@l3harris.com (Vincent Marciante)
Injection-Date: Tue, 20 Apr 2021 15:10:30 +0000
Content-Type: text/plain; charset="UTF-8"
Path: i2pn2.org!i2pn.org!news.niel.me!usenet.pasdenom.info!usenet-fr.net!feed.ac-versailles.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
 by: Vincent Marciante - Tue, 20 Apr 2021 15:10 UTC

I think that I used to know this but currently am not sure:

Assuming the a value is passed by reference, is 'Address of a parameter
always the address of the object that is passed as in:

....

type Big_Record is ...

Object : Big_Record;

procedure Proc (Param : in out Big_Record) is
begin
if Param'Address /= Object'Address then
raise Constraint_Error;
end if;
end;

begin
Proc(Object);
...

Also, does parameter mode (in, in out, out) make any difference?

Re: 'address on a subprogram parameter

<f97bd55d-ce27-46aa-95c7-961943a5e7fdn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5067&group=comp.lang.ada#5067

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:498d:: with SMTP id t13mr27528218qvx.49.1618933923718;
Tue, 20 Apr 2021 08:52:03 -0700 (PDT)
X-Received: by 2002:a25:f40f:: with SMTP id q15mr25233678ybd.73.1618933923551;
Tue, 20 Apr 2021 08:52:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Tue, 20 Apr 2021 08:52:03 -0700 (PDT)
In-Reply-To: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=94.31.102.170; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf
NNTP-Posting-Host: 94.31.102.170
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f97bd55d-ce27-46aa-95c7-961943a5e7fdn@googlegroups.com>
Subject: Re: 'address on a subprogram parameter
From: christ-u...@t-online.de (AdaMagica)
Injection-Date: Tue, 20 Apr 2021 15:52:03 +0000
Content-Type: text/plain; charset="UTF-8"
 by: AdaMagica - Tue, 20 Apr 2021 15:52 UTC

I'm not a compiler builder, but pass by referene has always meant, you access the parameter object directly. And of course, the parameter mode does not (and must not) have any influence on the parameter passing method.
You can force pass by ref by adding access to the parameter.
In most cases, passing method is of no interest, compiler makes the correct choice. RM is silent on most types about this.
Tagged types and limited types are always PbR.

Re: 'address on a subprogram parameter

<s5mvrp$fu0$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5069&group=comp.lang.ada#5069

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: 'address on a subprogram parameter
Date: Tue, 20 Apr 2021 18:35:01 +0200
Organization: Adalog
Lines: 37
Message-ID: <s5mvrp$fu0$1@dont-email.me>
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Apr 2021 16:35:05 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8fddbc7caabab45c3419096c43f4ac1d";
logging-data="16320"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19t83jEDQja15KYS3SqcO2z"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.9.1
Cancel-Lock: sha1:gj3xeiLsPwdx+EyaVuYaj1mT2p0=
In-Reply-To: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
Content-Language: fr
 by: J-P. Rosen - Tue, 20 Apr 2021 16:35 UTC

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, is 'Address of a parameter
> always the address of the object that is passed as in:
>
> ...
>
> type Big_Record is ...
>
> Object : Big_Record;
>
> procedure Proc (Param : in out Big_Record) is
> begin
> if Param'Address /= Object'Address then
> raise Constraint_Error;
> end if;
> end;
>
> begin
> Proc(Object);
> ...
>
As usual, the real question is "why do you need that?"

If you want to check whether a parameter IS a certain variable, use
Param'Has_Same_Storage(Object). If you want to check whether variables
have a part in common, use Param'Overlaps_Storage (Object).
See 13.3 (73.1/3 .. 73.10/3)

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Re: 'address on a subprogram parameter

<13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5070&group=comp.lang.ada#5070

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:f68f:: with SMTP id p15mr28159375qvn.55.1618939103359;
Tue, 20 Apr 2021 10:18:23 -0700 (PDT)
X-Received: by 2002:a25:75d6:: with SMTP id q205mr25333235ybc.339.1618939103198;
Tue, 20 Apr 2021 10:18:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Tue, 20 Apr 2021 10:18:23 -0700 (PDT)
In-Reply-To: <s5mvrp$fu0$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=35.245.252.196; posting-account=XfA3zgkAAABoz6fRf3Tehtnqqr7Ycml-
NNTP-Posting-Host: 35.245.252.196
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com> <s5mvrp$fu0$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>
Subject: Re: 'address on a subprogram parameter
From: vincent....@l3harris.com (Vincent Marciante)
Injection-Date: Tue, 20 Apr 2021 17:18:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Vincent Marciante - Tue, 20 Apr 2021 17:18 UTC

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, is 'Address of a parameter
> > always the address of the object that is passed as in:
> >
> > ...
> >
> > type Big_Record is ...
> >
> > Object : Big_Record;
> >
> > procedure Proc (Param : in out Big_Record) is
> > begin
> > if Param'Address /= Object'Address then
> > raise Constraint_Error;
> > end if;
> > end;
> >
> > begin
> > Proc(Object);
> > ...
> >
> As usual, the real question is "why do you need that?"
>
> If you want to check whether a parameter IS a certain variable, use
> Param'Has_Same_Storage(Object). If you want to check whether variables
> have a part in common, use Param'Overlaps_Storage (Object).
> See 13.3 (73.1/3 .. 73.10/3)
>
>
> --
> J-P. Rosen
> Adalog
> 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
> Tel: +33 1 45 29 21 52
> https://www.adalog.fr

I actually do not want to test that: I just wrote that as an attempt to
make explicit want I was asking and what I did not expect (exception).
I am really working with old code where I am moving some logic out
from within a package body that contains the "address'd" variable to
an unassociated package that defines the "Big_Record" type and I
wanted to be sure that passing it as a parameter would (always) have
the same behavior with the variable being passed as a parameter.

Re: 'address on a subprogram parameter

<s5n36m$6ee$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5072&group=comp.lang.ada#5072

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.not.acm.org (Jeffrey R. Carter)
Newsgroups: comp.lang.ada
Subject: Re: 'address on a subprogram parameter
Date: Tue, 20 Apr 2021 19:32:06 +0200
Organization: Also freenews.netfront.net; news.tornevall.net;
news.eternal-september.org
Lines: 14
Message-ID: <s5n36m$6ee$2@dont-email.me>
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
<f97bd55d-ce27-46aa-95c7-961943a5e7fdn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 20 Apr 2021 17:32:06 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="547c960cf1afa81c407cf6082b4bd11e";
logging-data="6606"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bhVutdm71rKZcjPmn2AWHDtF/E9eQjXY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.7.1
Cancel-Lock: sha1:+XSK8OoXS6I/UhgX9DGEUJFvnOc=
In-Reply-To: <f97bd55d-ce27-46aa-95c7-961943a5e7fdn@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R. Carter - Tue, 20 Apr 2021 17:32 UTC

On 4/20/21 5:52 PM, AdaMagica wrote:
> You can force pass by ref by adding access to the parameter.

I hope you meant to say "aliased", not "access". "Access" does not force pass by
reference; it forces pass by copy because access types are always passed by copy.

--
Jeff Carter
"I'm particularly glad that these lovely children were
here today to hear that speech. Not only was it authentic
frontier gibberish, it expressed a courage little seen
in this day and age."
Blazing Saddles
88

Re: 'address on a subprogram parameter

<ie8hirFnsc0U1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5073&group=comp.lang.ada#5073

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: 'address on a subprogram parameter
Date: Tue, 20 Apr 2021 20:33:15 +0300
Organization: Tidorum Ltd
Lines: 5
Message-ID: <ie8hirFnsc0U1@mid.individual.net>
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
<f97bd55d-ce27-46aa-95c7-961943a5e7fdn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net yAsSSRvpZOBrzeZRfcrtEQ5OfQYWlYF+SUbis1sNxyxiPKZUBw
Cancel-Lock: sha1:0GXi6+uQz9I2d3FeyCuhyI66ji8=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.7.0
In-Reply-To: <f97bd55d-ce27-46aa-95c7-961943a5e7fdn@googlegroups.com>
Content-Language: en-US
 by: Niklas Holsti - Tue, 20 Apr 2021 17:33 UTC

On 2021-04-20 18:52, AdaMagica wrote:

> You can force pass by ref by adding access to the parameter.

Or adding "aliased", which does not force one to use 'Access in the call.

Re: 'address on a subprogram parameter

<s5n9r3$crn$1@franka.jacob-sparre.dk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5079&group=comp.lang.ada#5079

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!paganini.bofh.team!newsfeed.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: 'address on a subprogram parameter
Date: Tue, 20 Apr 2021 14:25:22 -0500
Organization: JSA Research & Innovation
Lines: 26
Message-ID: <s5n9r3$crn$1@franka.jacob-sparre.dk>
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com> <s5mvrp$fu0$1@dont-email.me> <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>
Injection-Date: Tue, 20 Apr 2021 19:25:23 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="13175"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Tue, 20 Apr 2021 19:25 UTC

"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.

Re: 'address on a subprogram parameter

<07a090e1-85b4-4ebb-a093-dcda57b56579n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5081&group=comp.lang.ada#5081

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:7ca1:: with SMTP id z1mr19027021qtv.254.1618947679779;
Tue, 20 Apr 2021 12:41:19 -0700 (PDT)
X-Received: by 2002:a25:ccc1:: with SMTP id l184mr27262267ybf.165.1618947679628;
Tue, 20 Apr 2021 12:41:19 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Tue, 20 Apr 2021 12:41:19 -0700 (PDT)
In-Reply-To: <s5n9r3$crn$1@franka.jacob-sparre.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=35.245.252.196; posting-account=XfA3zgkAAABoz6fRf3Tehtnqqr7Ycml-
NNTP-Posting-Host: 35.245.252.196
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
<s5mvrp$fu0$1@dont-email.me> <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>
<s5n9r3$crn$1@franka.jacob-sparre.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <07a090e1-85b4-4ebb-a093-dcda57b56579n@googlegroups.com>
Subject: Re: 'address on a subprogram parameter
From: vincent....@l3harris.com (Vincent Marciante)
Injection-Date: Tue, 20 Apr 2021 19:41:19 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Vincent Marciante - Tue, 20 Apr 2021 19:41 UTC

On Tuesday, April 20, 2021 at 3:25:25 PM UTC-4, Randy Brukardt wrote:
> "Vincent Marciante" wrote in message
> 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.

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.

Re: 'address on a subprogram parameter

<6c3692a2-4e67-4d4e-8e8d-9807383fc050n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5087&group=comp.lang.ada#5087

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:7745:: with SMTP id s66mr21485415qkc.18.1618996791702;
Wed, 21 Apr 2021 02:19:51 -0700 (PDT)
X-Received: by 2002:a25:4883:: with SMTP id v125mr29472533yba.253.1618996791433;
Wed, 21 Apr 2021 02:19:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!fdn.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 21 Apr 2021 02:19:51 -0700 (PDT)
In-Reply-To: <s5n36m$6ee$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=94.31.102.170; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf
NNTP-Posting-Host: 94.31.102.170
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
<f97bd55d-ce27-46aa-95c7-961943a5e7fdn@googlegroups.com> <s5n36m$6ee$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6c3692a2-4e67-4d4e-8e8d-9807383fc050n@googlegroups.com>
Subject: Re: 'address on a subprogram parameter
From: christ-u...@t-online.de (AdaMagica)
Injection-Date: Wed, 21 Apr 2021 09:19:51 +0000
Content-Type: text/plain; charset="UTF-8"
 by: AdaMagica - Wed, 21 Apr 2021 09:19 UTC

Jeffrey R. Carter schrieb am Dienstag, 20. April 2021 um 19:32:08 UTC+2:
> On 4/20/21 5:52 PM, AdaMagica wrote:
> > You can force pass by ref by adding access to the parameter.
> I hope you meant to say "aliased", not "access". "Access" does not force pass by
> reference; it forces pass by copy because access types are always passed by copy.

Of course you're right. Sorry for the confusion.
The access value is passed by copy, if you then dereference, you get at the actual object.
I reall meant alias.

Re: 'address on a subprogram parameter

<44f2a351-0b1c-4779-b1ac-5509ef51585an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5099&group=comp.lang.ada#5099

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:21d9:: with SMTP id h25mr14407597qka.70.1619036263137;
Wed, 21 Apr 2021 13:17:43 -0700 (PDT)
X-Received: by 2002:a25:d6d2:: with SMTP id n201mr17978310ybg.504.1619036263005;
Wed, 21 Apr 2021 13:17:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 21 Apr 2021 13:17:42 -0700 (PDT)
In-Reply-To: <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC
NNTP-Posting-Host: 146.5.2.231
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
<s5mvrp$fu0$1@dont-email.me> <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <44f2a351-0b1c-4779-b1ac-5509ef51585an@googlegroups.com>
Subject: Re: 'address on a subprogram parameter
From: onewinge...@gmail.com (Shark8)
Injection-Date: Wed, 21 Apr 2021 20:17:43 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Shark8 - Wed, 21 Apr 2021 20:17 UTC

On Tuesday, April 20, 2021 at 11:18:24 AM UTC-6, Vincent Marciante wrote:
> I actually do not want to test that: I just wrote that as an attempt to
> make explicit want I was asking and what I did not expect (exception).
> I am really working with old code where I am moving some logic out
> from within a package body that contains the "address'd" variable to
> an unassociated package that defines the "Big_Record" type and I
> wanted to be sure that passing it as a parameter would (always) have
> the same behavior with the variable being passed as a parameter.
Why not use genreics?

Generic
Object : in out Big_Record;
Procedure Do_Something;

Remember, also, that you can supply subprograms in the formal parameters.

Re: 'address on a subprogram parameter

<2e6e9404-b7c3-4c38-a17b-ec18662bca9cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5102&group=comp.lang.ada#5102

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:4e45:: with SMTP id eb5mr2448605qvb.12.1619085283143;
Thu, 22 Apr 2021 02:54:43 -0700 (PDT)
X-Received: by 2002:a25:1883:: with SMTP id 125mr3351406yby.465.1619085282868;
Thu, 22 Apr 2021 02:54:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fdn.fr!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 22 Apr 2021 02:54:42 -0700 (PDT)
In-Reply-To: <44f2a351-0b1c-4779-b1ac-5509ef51585an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=35.245.252.196; posting-account=XfA3zgkAAABoz6fRf3Tehtnqqr7Ycml-
NNTP-Posting-Host: 35.245.252.196
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
<s5mvrp$fu0$1@dont-email.me> <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>
<44f2a351-0b1c-4779-b1ac-5509ef51585an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2e6e9404-b7c3-4c38-a17b-ec18662bca9cn@googlegroups.com>
Subject: Re: 'address on a subprogram parameter
From: vincent....@l3harris.com (Vincent Marciante)
Injection-Date: Thu, 22 Apr 2021 09:54:43 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Vincent Marciante - Thu, 22 Apr 2021 09:54 UTC

On Wednesday, April 21, 2021 at 4:17:43 PM UTC-4, Shark8 wrote:
> On Tuesday, April 20, 2021 at 11:18:24 AM UTC-6, Vincent Marciante wrote:
> > I actually do not want to test that: I just wrote that as an attempt to
> > make explicit want I was asking and what I did not expect (exception).
> > I am really working with old code where I am moving some logic out
> > from within a package body that contains the "address'd" variable to
> > an unassociated package that defines the "Big_Record" type and I
> > wanted to be sure that passing it as a parameter would (always) have
> > the same behavior with the variable being passed as a parameter.
> Why not use genreics?
>
> Generic
> Object : in out Big_Record;
> Procedure Do_Something;
>
> Remember, also, that you can supply subprograms in the formal parameters.

Using a method that ensure that the parameter will be passed by reference
is all that I need. Generics would just add one extra step - the instantiation.

Re: 'address on a subprogram parameter

<s5vs2o$m5t$1@franka.jacob-sparre.dk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5110&group=comp.lang.ada#5110

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!paganini.bofh.team!newsfeed.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: 'address on a subprogram parameter
Date: Fri, 23 Apr 2021 20:25:43 -0500
Organization: JSA Research & Innovation
Lines: 16
Message-ID: <s5vs2o$m5t$1@franka.jacob-sparre.dk>
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com> <s5mvrp$fu0$1@dont-email.me> <13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com> <s5n9r3$crn$1@franka.jacob-sparre.dk> <07a090e1-85b4-4ebb-a093-dcda57b56579n@googlegroups.com>
Injection-Date: Sat, 24 Apr 2021 01:25:44 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="22717"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Sat, 24 Apr 2021 01:25 UTC

"Vincent Marciante" <vincent.marciante@l3harris.com> 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. 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.

Re: 'address on a subprogram parameter

<iei8a8Fk652U1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5111&group=comp.lang.ada#5111

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.h...@tidorum.invalid (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
Lines: 39
Message-ID: <iei8a8Fk652U1@mid.individual.net>
References: <962020bb-97fc-42c3-8255-8f9b2bcbe204n@googlegroups.com>
<s5mvrp$fu0$1@dont-email.me>
<13f272e5-14a3-45cb-abf2-3d9f5a98f715n@googlegroups.com>
<s5n9r3$crn$1@franka.jacob-sparre.dk>
<07a090e1-85b4-4ebb-a093-dcda57b56579n@googlegroups.com>
<s5vs2o$m5t$1@franka.jacob-sparre.dk>
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: <s5vs2o$m5t$1@franka.jacob-sparre.dk>
Content-Language: en-US
 by: Niklas Holsti - Sat, 24 Apr 2021 09:56 UTC

On 2021-04-24 4:25, Randy Brukardt wrote:
> "Vincent Marciante" <vincent.marciante@l3harris.com> 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.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor