comp.lang.ada
 help / color / mirror / Atom feed
From: fraser@mundook.cs.mu.OZ.AU (Fraser Wilson)
Subject: Re: C++'s pointer vs Ada's Access type
Date: 1996/08/01
Date: 1996-08-01T00:00:00+00:00	[thread overview]
Message-ID: <4tpke4$9p8@mulga.cs.mu.OZ.AU> (raw)
In-Reply-To: DvFu6E.Atz.0.-s@inmet.camb.inmet.com


stt@henning.camb.inmet.com (johndoe) writes:

>Ding-yuan Sheu (dsheu@afit.af.mil) wrote:

>: 	int	Array[100];
>: 	ip = &Array;
>: 	for (i:=0;i++,99) { (*ip+i)   = 0; }

[ ... ]

[Tuck]
>In any case, the corresponding Ada would generally not use
>pointers at all:

>    An_Array : array (1..100) of Integer;

>    for I in An_Array'Range loop
>        An_Array(I) := 0;
>    end loop;

You're being very polite, Tuck, and I guess the reason is that Sheu
might want something more general, but I just can't resist letting
C and C++ people know when Ada, for want of a better phrase, kicks
butt so well.  Array initialisation is one of those areas:

	An_Array : array (1 .. 100) of Integer;

	An_Array := (others => 0);

(The C++ way has to be more efficient though, because it's closer
to the machine.  Not.)

Fraser (a frustrated Ada programmer who has to speak C++ at the moment)




  reply	other threads:[~1996-08-01  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-31  0:00 C++'s pointer vs Ada's Access type Ding-yuan Sheu
1996-08-01  0:00 ` David Weller
1996-08-01  0:00 ` johndoe
1996-08-01  0:00   ` Fraser Wilson [this message]
1996-08-01  0:00   ` Bryce Bardin
1996-08-01  0:00   ` Mark A Biggar
replies disabled

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