comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Call by reference vs. call by value
Date: 1996/07/22
Date: 1996-07-22T00:00:00+00:00	[thread overview]
Message-ID: <dewar.838068097@schonberg> (raw)
In-Reply-To: 31F39035.41C67EA6@swl.msd.ray.com


Karl asks

"This is really a C or C++ issue, but I still am not sure I understand.  I seem
to remember passing arrays as function parameters in both C and C++.  Since an
array reference is always implemented with a pointer in C and C++, all such
passing is pass by reference.  Why then do you say you can't pass arrays anyway?"


You can pass a pointer *by value* in either C or Ada or C++, but this is
NOT a call by reference. You can pass a *pointer* to an array, but not
an array itself in C, but in Ada you can pass either a pointer to an 
array (which obviously has reference semantics at the array abstraction
level, even though it is a call by value), OR you can pass an array.
It is when an array is passed, something you cannot do in C, that the
problem arises.

Why not just go to the C model of passing pointers around? you might ask!
The trouble with this approach is it requires far more aliasing than is
comfortable in a language of this class. 
\




  reply	other threads:[~1996-07-22  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-20  0:00 Call by reference vs. call by value Christopher Felaco
1996-07-20  0:00 ` James A. Krzyzanowski
1996-07-20  0:00   ` Robert Dewar
1996-07-20  0:00 ` Robert Dewar
1996-07-21  0:00   ` Robert A Duff
1996-07-21  0:00     ` Robert Dewar
1996-07-22  0:00       ` Robert A Duff
1996-07-23  0:00         ` Peter Amey
1996-07-23  0:00           ` Robert Dewar
1996-07-24  0:00             ` Robert A Duff
1996-07-23  0:00           ` Robert A Duff
1996-07-27  0:00             ` Peter Morris
1996-07-28  0:00               ` Robert A Duff
1996-07-24  0:00           ` Richard A. O'Keefe
1996-07-22  0:00   ` Karl Cooper {46901}
1996-07-22  0:00     ` Robert Dewar [this message]
1996-07-22  0:00   ` Felaco
1996-07-22  0:00     ` Robert Dewar
1996-07-22  0:00     ` Robert A Duff
1996-07-30  0:00       ` Richard A. O'Keefe
1996-07-30  0:00   ` Felaco
1996-07-31  0:00     ` Robert A Duff
1996-08-02  0:00     ` Robert Dewar
1996-08-03  0:00     ` JP Thornley
1996-08-05  0:00       ` Roderick Chapman
1996-07-21  0:00 ` Robert A Duff
1996-07-21  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1996-07-25  0:00 Marin David Condic, 407.796.8997, M/S 731-93
1996-07-26  0:00 ` Peter Amey
replies disabled

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