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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1042f393323e22da X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Any research putting c above ada? Date: 1997/05/07 Message-ID: #1/1 X-Deja-AN: 240109889 Distribution: world References: <5ih6i9$oct$1@waldorf.csc.calpoly.edu> <5ijb0o$ajc@ns1.sw-eng.falls-church.va.us> <334d3da5.14386594@aplcen.apl.jhu.edu> <2senchydgk.fsf@hpodid2.eurocontrol.fr> <5im3an$3dv@bcrkh13.bnr.ca> <2sybamvslk.fsf@hpodid2.eurocontrol.fr> <5ius80$1nr8@newssvr01-int.news.prodigy.com> <335ae79e.55ed@dynamite.com.au> <5jde9l$u8q@newssvr01-int.news.prodigy.com> <33643f1f.0@news2.maynick.com.au> <5k3fma$126a@newssvr01-int.news.prodigy.com> <336eda35.0@news2.maynick.com.au> Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-05-07T00:00:00+00:00 List-Id: In article clines@delete_this.airmail.net (Kevin Cline) writes: > >The commonest errors (by far) that I have seen in > >years of debugging other people's code (and some of my own) have been > >pointer mismanagement and off-by-one errors in array processing. Ada > >really does shine in helping you avoid these (as well as having many > >other good points). > > How does Ada help you avoid the problem of managing dynamically allocated > memory? Two obvious ways leap to mind. First, pathological uninitialized pointer behavior is not possible. You just get constraint error and in a debugger this plops you at the exact location of the goof. Second, many places where in C/C++ you must use heap allocation just go away altogether: functions can return objects of arbitrary size (strings, records/structs, arrays of any sort, etc.) Clearly, if you don't need to use the heap you don't have management problems. Now, if you really do need to use the heap (lots of threaded together structures, CarCdr lists, etc., etc.) Ada does not give you much direct support for managing this stuff. It does provide enough indirect support (storage pools, generics, limited types, unknown discriminants in client interface, etc.) for someone to construct automated management of this stuff. /Jon -- Jon Anthony Organon Motives, Inc. Belmont, MA 02178 617.484.3383 jsa@organon.com