comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: question about functions
Date: 2000/01/22
Date: 2000-01-22T00:00:00+00:00	[thread overview]
Message-ID: <m5ni4.1839$lN4.95267@newsread1.prod.itd.earthlink.net> (raw)
In-Reply-To: 3889A56C.61C4@nospam.com.tj

In article <3889A56C.61C4@nospam.com.tj> , Andy <andy@nospam.com.tj>  
wrote:

>> One alternate approach that is possible in Ada is to pass the result
>> as an 'out' parameter :
>>
>> procedure f (A, B : in T; C : out T);
>>
>> now you can do C'Address.
>>
> But this would give the address of the formal parameter which
> may not be the address of the actual parameter. Unless T is a
> tagged type, isn't the compiler free pass parameters by
> reference or value?

Certain types are guaranteed to be passed by reference.  By-reference
types include tagged types and limited types.  (Note that a limited type
doesn't have to be tagged to be passed by reference.)

Scalar types must be passed by value.

The language doesn't specify whether composite types (nonlimited records
arrays) are passed by reference or by value.

If you want to take the address (here, C'Address) of a subprogram
parameter, the parameter must be a by-reference type: either tagged or
limited.

See RM95 13.3 (16).

--
Philosophy may be ignored but not escaped; and those who most ignore
least escape.

David Hawkins





  reply	other threads:[~2000-01-22  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-20  0:00 question about functions Pascal LEJEUNE
2000-01-20  0:00 ` Hyman Rosen
2000-01-20  0:00 ` David Starner
2000-01-20  0:00 ` Stephen Leake
2000-01-22  0:00   ` Matthew Heaney
2000-01-24  0:00     ` Stephen Leake
2000-01-25  0:00       ` Matthew Heaney
2000-01-27  0:00         ` Stephen Leake
2000-01-24  0:00     ` Mats Weber
2000-01-22  0:00   ` Andy
2000-01-22  0:00     ` Matthew Heaney [this message]
2000-01-24  0:00     ` Stephen Leake
2000-01-20  0:00 ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
2000-01-21  0:00 Pascal LEJEUNE
2000-01-21  0:00 ` tmoran
2000-01-21  0:00   ` Samuel T. Harris
2000-01-21  0:00     ` Stephen Leake
replies disabled

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