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=0.6 required=5.0 tests=BAYES_05,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.ada,comp.lang.c,sci.space,sci.space.shuttle Subject: Re: "C" vrs ADA Message-ID: <8513@utzoo.UUCP> Date: Sat, 29-Aug-87 02:25:25 EDT Article-I.D.: utzoo.8513 Posted: Sat Aug 29 02:25:25 1987 Date-Received: Sat, 29-Aug-87 02:25:25 EDT References: <1065@vu-vlsi.UUCP> <2231@cbmvax.UUCP> <36@sarin.UUCP> Organization: U of Toronto Zoology List-Id: > Um... How do these [safe] C environments detect subscript range errors > in a piece of code like: > > strcpy(s,t) > char *s, *t; > { while (*s++ = *t++); return s;} Easy, a pointer becomes a non-trivial data structure that carries bounds with it; those bounds are checked when it is used. Remember that pointer arithmetic is technically legal only within a single array. Getting the little details right must be a bit tricky in spots, but it does work. > Although an unhandled exception in C "typically" produces a dump, > it does not "always" produce a dump. Also, the dump may occur long > after the invalid code was executed, making it more difficult to figure > out what went wrong. This property is shared by *all* programming languages that can generate run-time exceptions; usually the actual exception shows up at some remove from the bug that actually caused it. Unless Ada is much more radical than I remember (it's been a long time since I read the definition), it is just as subject to this problem as C. -- "There's a lot more to do in space | Henry Spencer @ U of Toronto Zoology than sending people to Mars." --Bova | {allegra,ihnp4,decvax,utai}!utzoo!henry