From: Mark Lorenzen <mark.lorenzen@ofir.dk>
Subject: Re: Unbounded Strings
Date: Thu, 09 Oct 2003 01:55:08 +0200
Date: 2003-10-09T01:55:08+02:00 [thread overview]
Message-ID: <m3pth7i8tf.fsf@niflheim.malonet> (raw)
In-Reply-To: _XYgb.3237$dn6.2766@newsread4.news.pas.earthlink.net
Jeffrey Carter <spam@spam.com> writes:
> Andrew Carroll wrote:
>
[snip]
>
>> I found myself desingning more and debugging less. There were still
>> problems
>> of course, such as pass by value or pass by reference; I didn't know what to
>> use
>> nor did I know if I had to specify it. I found out when I created my first
>> graph,
>> you have to specify out paramter or in and out for the parameter or you get
>> a
>> copy instead of the actual "thing".
>
> This represents a serious misunderstanding of Ada parameter modes. All
> elementary types are passed by copy, regardless of the parameter
> mode. All tagged and limited types are passed by reference, regardless
> of the parameter mode. For all other types, the compiler chooses the
> parameter mode best suited to the type. Mode in means the subprogram
> receives a value from the caller, and cannot modify it; out means the
> subprogram provides a value to the caller, and in out means the caller
> provides a value which the subprogram may modify. Parameter modes have
> nothing to do with parameter passing mechanisms. See ARM 6.2.
>
Hint to Andrew: Don't think about _how_ parameters are passed (i.e. by
copy or by reference) for "For all other types" as Jeffrey says
above. Use "in", "in out" and "out" to express your _intentions_ with
the parameters. Don't worry about efficientcy - the compiler will do
"the right thing".
- Mark
next prev parent reply other threads:[~2003-10-08 23:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20031007175516.DC2884C40C8@lovelace.ada-france.org>
2003-10-08 5:52 ` Unbounded Strings Andrew Carroll
2003-10-08 6:22 ` Preben Randhol
2003-10-08 13:10 ` Marin David Condic
2003-10-08 13:19 ` Steve O'Neill
2003-10-08 18:46 ` Jeffrey Carter
2003-10-08 23:55 ` Mark Lorenzen [this message]
2003-10-09 18:23 ` Craig Carey
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox