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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5d3a1501d97dab65 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: C to Ada : a piece of code Date: 1996/09/09 Message-ID: <01bb9e40$d0312d80$348371a5@dhoossr.iquest.com>#1/1 X-Deja-AN: 179434167 distribution: world references: <3231732C.2781@virgoa4.in2p3.fr> <01bb9d61$537fe5e0$2b8371a5@dhoossr.iquest.com> content-type: text/plain; charset=ISO-8859-1 organization: DBH Enterprises, Inc. mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-09-09T00:00:00+00:00 List-Id: Jon S Anthony wrote in article ... > In article <01bb9d61$537fe5e0$2b8371a5@dhoossr.iquest.com> "David C. Hoos, Sr." writes: > Well, sure. I guess I should have included an ellipsis after the end > loop to show the rest of whatever you might want to do. Also, there's > no reason why you couldn't just eliminate the declare block by means > of a subprogram. As for not using malloc in this case, I see that as > a real good thing - no memory management to deal with. As far as > calloc, you can just add an initializer (for unknown reasons since he > just sets all the values anyway). And you can always pass such an > array around via parameters or function returns - again no need for > the allocator. Please explain to me how, (since the size of the array required is acquired through standard input) if dynamic memory allocation is not used, you're going to acquire static memory of the specified size, to which access can be safely passed without it's going out of scope. In fact, gnat has gotten smarter than, say, VADS, in this regard, in that it will tell you when you're passing access to memory that would be out of scope. > Shrug. It uglifies the dynamic array allocation (needing a -1). He > said _equivalent_ Ada, not "identical" word for word translation. In > fact, an identical word for word translation of this particular case > is just bad Ada. The trade off, (in those frequent cases where 0-based indexing is more appropriate) is the one-time ugliness of the allocation, vs. the every time ugliness of the references which need something like Vect'FIRST subtracted during index computation. -- David C. Hoos, Sr., http://www.dbhwww.com http://www.ada95.com >