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.arch Subject: Re: Wirth's "challenge" (was Re: RISC) Message-ID: <8933@utzoo.UUCP> Date: Sat, 14-Nov-87 21:49:13 EST Article-I.D.: utzoo.8933 Posted: Sat Nov 14 21:49:13 1987 Date-Received: Sat, 14-Nov-87 21:49:13 EST References: <1656@geac.UUCP> <863@winchester.UUCP> <197@m2.mfci.UUCP>, <902@mips.UUCP> Organization: U of Toronto Zoology Lines: 30 Keywords: RISC,array > ... He mentioned items like undetected integer overflows... Sigh, I note that the SPARC architecture, which looks like it's going to be pretty popular, does not trap integer overflows. (At least, I don't recall it doing so -- I don't have the spec handy.) Of course, it sets the good old V bit, which you can check after every instruction if you don't mind the performance penalty... meaning that nobody who cares about performance will bother. Sigh. > ... For example, the lack of > overflow checking and array bounds checking in C may have started as a > reflection of the hardware architectures in place at the time... No, not correct. The "lack of overflow checking" is mythical -- C has *never* promised that except for unsigned integers, which exist partly for that specific purpose. Many implementations don't check overflow, and there is undoubtedly some code that depends on this, but this has little or nothing to do with the language. And array-bounds checking is (a) a little difficult to reconcile with the explicit pointer-based semantics of C's arrays, but nevertheless (b) possible in C, as witness at least one debugging-oriented implementation I know of. ([mount soapbox] Besides, run-time checking for such things is the wrong approach; no well-built program should ever do such things, and well- builtness is something that ought to be checkable at compile time -- a superior approach in every way except that implementation is harder and not entirely understood yet.) -- Those who do not understand Unix are | Henry Spencer @ U of Toronto Zoology condemned to reinvent it, poorly. | {allegra,ihnp4,decvax,utai}!utzoo!henry