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.2 required=5.0 tests=BAYES_00,FROM_WORDY, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,effb80d4bb7716dd X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: Pointer Arithmetic (was: Wanted: Ada STL....) Date: 1999/02/03 Message-ID: <798lej$69d$1@plug.news.pipex.net>#1/1 X-Deja-AN: 440063685 References: <790f4q$3l@bgtnsc01.worldnet.att.net> <797na3$obg$1@nnrp1.dejanews.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: UUNET WorldCom server (post doesn't reflect views of UUNET WorldCom) Newsgroups: comp.lang.ada Date: 1999-02-03T00:00:00+00:00 List-Id: All unnecessary, Adam. Nowadays, (most) optimising compilers do what you suggest automatically, without the need for a pragma. A loop of the kind for i in 1..10 loop a(i) := b(i) + c(i); end loop; will be compiled as if you had written xyz *pa = &a[0]; xyz *pb = &b[0]; xyz *pc = &c[0]; <10 times>{ *pa++ = *pb++ + *pc++; }; and is also likely to have loop unrolling, instruction scheduling, and lots of other things, applied, all to speed up your humble loop. ------------------------------------------- Nick Roberts ------------------------------------------- adam@irvine.com wrote in message <797na3$obg$1@nnrp1.dejanews.com>... [...] |Pointer arithmetic can be efficient when you're trying to |step through an array, since you don't have to keep multiplying an index by a |constant value to access the array elements. [...]