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=2.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f0a4dc584cb226d8,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.204.129.78 with SMTP id n14mr209754bks.5.1324429731485; Tue, 20 Dec 2011 17:08:51 -0800 (PST) Path: jh9ni35318bkb.0!nntp.google.com!news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!gegeweb.org!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Basic question on Ada multi-dimensional arrays, are they true (contiguous) arrays? aliasing rules? Date: Tue, 20 Dec 2011 19:08:11 -0600 Organization: Aioe.org NNTP Server Message-ID: Reply-To: nma@12000.org NNTP-Posting-Host: knI2LMO8gnYIGpSs3mYeZQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-12-20T19:08:11-06:00 List-Id: Sorry for such a basic question on Ada, it has been a while since I used Ada (but it remains my most favorite computer language). We know that Fortran stores multi-dimensional arrays in a contiguous sequence of memory, and Fortran has strong aliasing rules which allows the compiler to more generate more efficient code when it comes to Matrices access and manipulation and such. This is one reason that Fortran code is fast for number crunching. How is the situation in Ada when it comes to this issue? I am almost sure that Ada 2D/3D matrices are also contiguous in memory (as compared to say Java for example). If so, how is the issue with aliasing rules? I read that c99 has now a keyword called 'restrict' which is supposed to tell the compiler that some arrays do not overlap in memory and the compiler can generate efficient code like Fortran. So my question really is: Is Ada generated code now for 2D/3D matrices operations as efficient and Fast as Fortran? Are there switches for Gnat that one can use to improve this aspect of the code generation? Are there are benchmarks comparing Ada for Fortran in this specific area? Sorry if my question might be too general and not specific, but I am just only wondering on how Ada number crushing with matrices compares to Fortran there days. thanks, --Nasser