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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!linac!att!news.cs.indiana.edu!msi.umn.edu!sctc.com!stachour From: stachour@sctc.com (Paul Stachour) Newsgroups: comp.lang.ada Subject: Initialization Message-ID: <1991Mar27.213254.4046@sctc.com> Date: 27 Mar 91 21:32:54 GMT References: <20600091@inmet> <23141@as0c.sei.cmu.edu> <2918@sparko.gwu.edu> <5070@goanna.cs.rmit.oz.au> Organization: SCTC List-Id: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: >I would rather see features that help people detect or avoid the error >of using an uninitialised variable rather than features which define >the problem away. For example, if arrays with fill pointers were a >standard part of the language (perhaps defined as a standard package), >then we'd be close enough to Dijkstra's arrays to get some of the >protection without being too far from the kind of array already present. >Don't expect default initial values for types to be an unmixed blessing. As one who has programmed regularly in more than an half-dozen languages, and has worked on teams that have implemented 3 compilers for different lanauges, I agree. If you have a variable that is unitialized, then a good flow anyalysis tool (we had some inside one of the compilers) can follow your control-flow and give you "used before set" messages. When you do have something initialized, it is, by definition, set. Thus the flow-analysis gives you nothing. I long for the (ancient) FORTRAN II compiler I used on an IBM 7074 in the mid-1960s. It set all of the words in the machine to an "invalid pattern" before beginning your program. And then if you fetched anything that hadn't been set, you took a hardware fault and the run-time told what you were doing wrong. Much like Saber-C and other good c-interpreters can do today, but with hardware support. One problem is when you have an uninitialized item as a component of a struacture and you assign one instance of the structre to another. Do you get a fault or not. You really aren't "using" the item yet. Enjoy. ...Paul -- Paul Stachour SCTC, 1210 W. County Rd E, Suite 100 stachour@sctc.com Arden Hills, MN 55112 [1]-(612) 482-7467