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: 103376,4692663255b51613 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!y31g2000prd.googlegroups.com!not-for-mail From: Phil Clayton Newsgroups: comp.lang.ada Subject: Re: on using array index, vectorized operation Date: Sun, 27 Mar 2011 15:37:13 -0700 (PDT) Organization: http://groups.google.com Message-ID: <74980e07-b6d2-42ee-9354-5c2dfd5fdcde@y31g2000prd.googlegroups.com> References: <5efa3275-a42b-4d97-ac75-428f8cdf895d@j13g2000pro.googlegroups.com> NNTP-Posting-Host: 91.110.161.61 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1301265434 10672 127.0.0.1 (27 Mar 2011 22:37:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 27 Mar 2011 22:37:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y31g2000prd.googlegroups.com; posting-host=91.110.161.61; posting-account=v7gx3AoAAABfjb9m5b7l_Lt2KVEgQBIe User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.1.9) Gecko/20100330 Fedora/3.5.9-1.fc12 Firefox/3.5.9,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:19490 Date: 2011-03-27T15:37:13-07:00 List-Id: On Mar 27, 11:00=A0pm, "Nasser M. Abbasi" wrote: > Only problem now is that I need to figure the castings I need > to do to make the compile happy, Since now I get the error: > > $ gnatmake foo.adb > gcc-4.4 -c foo.adb > foo.adb:10:14: there is no applicable operator "-" for type "buffer_t" de= fined at line 2 > gnatmake: "foo.adb" compilation error > $ > > Will look at this now, how best to solve this? I understand > that it want me to define a "-" operator for buffer_t. I really do > not want to cast things, I need to find the best solution to this. > > May be I need to define a function "-" for buffer_t ? (So please ignore my previous question.) I had a similar quandary a few years ago where it was necessary to describe results of vectorized operations (from Simulink as it happens) using a language that had no natural support for vectorization. The thought of defining variants of operations to work on 1-D arrays, another set of variants for 2-D arrays etc. was too horrendous. It was far simpler to promote scalar operations using a loop, like in your example. (We actually produced a vectorized meta- notation that allowed an expression form of loop like 'for-aggregates' that I've mentioned before, so didn't need to deal with temporary variables.) My advice would be to stick to the loop version, with temporary variables if necessary, as that is most traceable to the original text and surely the most maintainable. Phil > But I am happy now that at least I can avoid explicit loops if needed.