comp.lang.ada
 help / color / mirror / Atom feed
From: "David Thompson" <david.thompson1@worldnet.att.net>
Subject: Re: Re[2]: Ada The Best Language?
Date: Tue, 31 Jul 2001 05:24:58 GMT
Date: 2001-07-31T05:24:58+00:00	[thread overview]
Message-ID: <Kir97.21673$LP2.1319407@bgtnsc06-news.ops.worldnet.att.net> (raw)
In-Reply-To: fqj57.23735$Kf3.319906@www.newsranger.com

Ted Dennison <dennison@telepath.com> wrote in message
news:fqj57.23735$Kf3.319906@www.newsranger.com...
...
> I'm sorry to answer for the troll you're chasing after, but the answer to that
> depends on what you consider a pointer. You can certianly make array-based
> objects in C without using dynamic allocation. However, every array in C is
> basicly a chunk of memory and a pointer with a preset "[]" operation for
> performing pointer math on it. In that sense, you can't even have an array in
C
> without using a pointer.

Nit:  in BCPL and B there was a real pointer for each array variable;
in C such a pointer is instead formed "on demand" -- when you
reference an array (except 2 special cases, 3 in C++) it is silently
converted to a pointer to the first element, often called "decay",
and subscripting [] is actually defined on this resulting pointer,
so yes you are "using" a pointer even though it wasn't stored.
And when you declare a function(subprogram) (formal)parameter
as an array, it actually declares a pointer instead, which can be
passed by-value from a decayed array, and used to access it.
(And subscripting is commutative!)

This evolution is described in Dennis Ritchie's ACM2HOPL paper,
also available on http://cm.bell-labs.com/cm/cs/who/dmr/

--
- David.Thompson 1 now at worldnet.att.net








  reply	other threads:[~2001-07-31  5:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-18 14:40 Re[2]: Ada The Best Language? ANH_VO
2001-07-18 17:10 ` Ted Dennison
2001-07-31  5:24   ` David Thompson [this message]
2001-07-26  1:53 ` Lao Xiao Hai
2001-08-06 22:41 ` Re[2]: " cppwiz
replies disabled

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