From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Pointer to instance of indefinite array?
Date: Tue, 12 Aug 2014 21:28:14 -0700
Date: 2014-08-12T21:28:14-07:00 [thread overview]
Message-ID: <lsepgv$mnp$1@dont-email.me> (raw)
In-Reply-To: <58a951df-217b-48ee-bd0b-f9953f5b622b@googlegroups.com>
On 08/12/2014 08:06 PM, NiGHTS wrote:
>
> Hmm. You're right. It worked! Compiler must be changing it internally to a
> pointer though since it would be far too inefficient to copy the entire
> array.
The parameter-passing mechanism used by the compiler is generally not something
we need to worry about.
Having to explicitly pass a pointer to obtain by-reference semantics is a mark
of low-level languages. It is not a good way to do almost anything.
In a mid-level language, such as Pascal, one often specifies the
parameter-passing mechanism, and the compiler uses that mechanism. This is
pretty much what VAR (by reference) and non-VAR (by copy) parameters are in
Pascal, though they're usually described in terms of whether or not changes to
the formal parameter also change the actual.
In a high-level language, such as Ada, one specifies how the subprogram uses the
parameter (in, in out, and out modes) and the compiler uses that and the type
being passed to determine the parameter-passing mechanism.
--
Jeff Carter
"That was the most fun I've ever had without laughing."
Annie Hall
43
next prev parent reply other threads:[~2014-08-13 4:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 2:07 Pointer to instance of indefinite array? NiGHTS
2014-08-13 2:09 ` Jeffrey Carter
2014-08-13 2:29 ` Shark8
2014-08-13 3:06 ` NiGHTS
2014-08-13 4:28 ` Jeffrey Carter [this message]
2014-08-13 16:06 ` NiGHTS
2014-08-13 17:43 ` Jeffrey Carter
2014-08-13 17:58 ` Shark8
2014-08-13 18:36 ` Dmitry A. Kazakov
2014-08-13 4:31 ` Per Sandberg
2014-08-13 7:47 ` Georg Bauhaus
2014-08-13 8:05 ` Egil H H
2014-08-13 15:32 ` Adam Beneschan
2014-08-14 8:03 ` Georg Bauhaus
2014-08-13 18:17 ` Niklas Holsti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox