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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 108717,a7c8692cac750b5e X-Google-Thread: 103376,703c4f68db81387d X-Google-Attributes: gid108717,gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail From: Dave Thompson Newsgroups: comp.programming,comp.lang.ada Subject: Re: 10 rules for benchmarking (was Re: Teaching new tricks to an old dog (C++ -->Ada)) Message-ID: <74ns31pt0ion16noor98fv8o6j51upc5u4@4ax.com> References: <113394jjvppao64@corp.supernews.com> <1133s3qnmqmbjfb@corp.supernews.com> <4232a9f7$0$26552$9b4e6d93@newsread4.arcor-online.net> <11369p5jrcc6835@corp.supernews.com> <1110697151.726709.276550@l41g2000cwc.googlegroups.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 21 Mar 2005 05:59:28 GMT NNTP-Posting-Host: 12.75.203.48 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1111384768 12.75.203.48 (Mon, 21 Mar 2005 05:59:28 GMT) NNTP-Posting-Date: Mon, 21 Mar 2005 05:59:28 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.programming:18254 comp.lang.ada:9659 Date: 2005-03-21T05:59:28+00:00 List-Id: On Sun, 13 Mar 2005 19:48:52 -0500 (EST), "Arthur J. O'Dwyer" wrote: > >> On Sun, 13 Mar 2005, Jim Rogers wrote: > >>> > >>> procedure Do_Array(X : Combiner) is > >>> PA : Element_Ptr; > >>> begin > >>> Pa := X.P; -- assign all elements of X.P to Pa > >>> Pa(2).all := 1; -- Assign 1 to the second value in the array > >> > >> For my own edification: Am I correct in thinking that the ".all" > >> is superfluous in this expression? > > > > Not at all. This is equivalent to the C syntax > > *(p[1]) = 1; > > Where '.all' corresponds to C's '*' operator, right. I thought > I recalled reading that Ada would infer the '.all' to make the types > work out in some cases (similarly to Algol?); either I read wrong, > or this just isn't one of those cases. Ada will automatically dereference an access type (i.e. pointer) if it is clear from 'syntax': access-to-array followed by parenthesized subscript access-to-record (struct) followed by dot member access-to-subprogram followed by parenthesized argument list access-to-anything followed by apostrophe and an attribute (name) that is valid for the target but not for the access For access-to-scalar, or where you want a whole array or record, you need .all to get the target (value) rather than the pointer. Ada does not search for a set of dereferences that make LHS and RHS match like algol. Although it does do overload resolution (which algol didn't even have) including the 'expected' type (most simply assignment LHS). - David.Thompson1 at worldnet.att.net