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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,83d2d63f98e99c58 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-14 13:55:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!wn13feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: C to Ada conversion References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1042581335 12.234.13.56 (Tue, 14 Jan 2003 21:55:35 GMT) NNTP-Posting-Date: Tue, 14 Jan 2003 21:55:35 GMT Organization: AT&T Broadband Date: Tue, 14 Jan 2003 21:55:35 GMT Xref: archiver1.google.com comp.lang.ada:33020 Date: 2003-01-14T21:55:35+00:00 List-Id: > > Rs : constant := 6; > > type Matrices is array (1 .. Rs, 1 .. Rs) of Float; > Do you think that's fair ?-) The original profile of the C routine was > > int MatrixInversion(float* A, int n, float* AInverse) Oops. I saw the #define on rs before the array declarations and thought "Aha, known at compile time", but of course you are right that the Matrix_Inversion routine doesn't depend on rs and will take any size array. So I withdraw my suggestion. > This is NOT pointless because a piece of code should also > work correctly if someone turns off the automatic checks in Ada. I disagree. Turning off checks is a substantial change to the assumptions of the programmer. If he coded to not depend on the assumption that checks are on, great. But I don't think one should assume the programmer didn't assume checks unless he says so. If the code should be able to run with checks off, there's no reason to ever have them on, and the source code should include the pragma to turn them off. Converting index ranges like this by passing to a subroutine is very nice. I hadn't seen that done before.