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,5ecb5248e650e812 X-Google-Attributes: gid103376,public From: jsa@alexandria.organon.com (Jon S Anthony) Subject: Re: Ada and robots Date: 1997/06/27 Message-ID: #1/1 X-Deja-AN: 253050326 Distribution: world References: <9706262213.AA13647@stealth.ctron.com> Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-06-27T00:00:00+00:00 List-Id: In article <9706262213.AA13647@stealth.ctron.com> Huy Vo writes: > >> You rely on the runtime system telling you what line it fails? > > > >No. All such stuff should be isolated with a non-lowlevel interface. > >Inside the implementation exception handler(s) take the appropriate > >action. Outside, no one cares or needs to care. > > > Someone has to care, Jon. Because if you dynamically allocate memory > at 101 places in your 100K lines of code and only one of > the allocations failed, you really want to know which one failed. Hardly. In general, that will not be at all informative. The problem will have been caused by a memory _leak_ - for which, who's attempting final allocation is completely irrelevant. > As an application programmer what would you do? As a compiler writer > that has to provide a default handler for this type of situation > what would you do? > > In C, it's as simple as > > if (!(cp =malloc(BIG_CHUNK)) { > fprintf(stderr, "Buy some more ram, i died at line %d\n", __LINE__); > exit(1); > } This is a joke, right? Anyone I ever see writing god-awful code like the above would get sent back for some remedial lessons. > Show me your code. Equivalent lousy Ada code: exception when E : Storage_Error => Put_Line( Exception_Name(E) & ": " & Exception_Information(E) & "In function Parser.Parse_Derived_Type_Def.Array_Type," & when attempting to allocate node for anonymous array type." ); /Jon -- Jon Anthony OMI, Belmont, MA 02178 617.484.3383 "Nightmares - Ha! The way my life's been going lately, Who'd notice?" -- Londo Mollari