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,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newscon02.news.prodigy.com!prodigy.net!newsmst01a.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr13.news.prodigy.com.POSTED!4988f22a!not-for-mail From: Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng References: <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <1110329098.642196@athnrd02> <1110361741.551255@athnrd02> <422edaec$0$26554$9b4e6d93@newsread4.arcor-online.net> <1111464133.508323@athnrd02> <423fe9df$0$11476$9b4e6d93@newsread2.arcor-online.net> <1111521825.653841@athnrd02> <424094b0$0$11481$9b4e6d93@newsread2.arcor-online.net> <1111568404.687226@athnrd02> <42416659$0$11476$9b4e6d93@newsread2.arcor-online.net> <1111611226.253249@athnrd02> <4241f47a$0$24073$9b4e6d93@newsread4.arcor-online.net> <1111627358.387482@athnrd02> <424222df$0$24057$9b4e6d93@newsread4.arcor-online.net> <1111632436.374702@athnrd02> <1111698643.735412.144620@l41g2000cwc.googlegroups.com> <424362cc$0$11478$9b4e6d93@newsread2.arcor-online.net> <1111717144.891831@athnrd02> <42446836$0$11463$9b4e6d93@newsread2.arcor-online.net> Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: <3I31e.2687$zl.1586@newssvr13.news.prodigy.com> NNTP-Posting-Host: 69.109.141.119 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr13.news.prodigy.com 1111803775 ST000 69.109.141.119 (Fri, 25 Mar 2005 21:22:55 EST) NNTP-Posting-Date: Fri, 25 Mar 2005 21:22:55 EST Organization: SBC http://yahoo.sbc.com X-UserInfo1: TSU[@IONTBWQR]TX\ZIBNFXBWR\HPCTL@XT^OBPLAH[\BTUCCNSKQFCY@TXDX_WHSVB]ZEJLSNY\^J[CUVSA_QLFC^RQHUPH[P[NRWCCMLSNPOD_ESALHUK@TDFUZHBLJ\XGKL^NXA\EVHSP[D_C^B_^JCX^W]CHBAX]POG@SSAZQ\LE[DCNMUPG_VSC@VJM Date: Sat, 26 Mar 2005 02:22:55 GMT Xref: g2news1.google.com comp.lang.ada:10006 comp.lang.c++:47309 comp.realtime:1730 comp.software-eng:5346 Date: 2005-03-26T02:22:55+00:00 List-Id: "Dr. Adrian Wrigley" wrote: > > A key point is that C arrays are considered 'evil' to C++ programmers. > > C arrays: > 1) don't have their subscripts checked > 2) often need heap allocation and manual deletion > 3) cannot be returned (when 'auto') > 4) are rather mixed up with bug-prone pointer based code > And this doesn't even address the issues of multi-dimensional arrays, which, in Ada, are true multi-dimensional arrays. type Day is (Mon, Tue, Wed, Thu, Fri, Sat, Sun); type Index is range 1..31; type TwoDMatrix is array(Day, Index) of Boolean; or if you wish, type DayVector is array(Day) of Boolean; type Month is array(Index) of DayVector; and one is not limited to two dimensions for true arrays. type ThreeDMatrix is array(1..20, 1..400, 1..2000) of Integer; TDM1 : ThreeDMatrix; ... for TDM1'Range(1) loop for TDM1'Range(2) loop for TDM1'Range(3) loop -- Do something to Integer element end loop; end loop; end loop; where the parenthetical values specify which dimension is being evaluated. Multi-dimensional array processing in Ada is so easy to do. Moreover, it is easy, no trivial, to create generic templates to take advantage of this capability to create portable, generalized, and and easy to use generic components. Easier, I think, than the equivalent capability in most other languages, especially C++. Richard Riehle