From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ed3864cb23152ae6 X-Google-Attributes: gid103376,public From: fraser@mundook.cs.mu.OZ.AU (Fraser Wilson) Subject: Re: C++'s pointer vs Ada's Access type Date: 1996/08/01 Message-ID: <4tpke4$9p8@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 172458771 distribution: world references: <31FFD4A6.41C6@afit.af.mil> organization: Comp Sci, University of Melbourne newsgroups: comp.lang.ada Date: 1996-08-01T00:00:00+00:00 List-Id: 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)