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,803df5f3f60558d5 X-Google-Attributes: gid103376,public From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: Uninitialized "out" parameters Date: 1996/07/24 Message-ID: <4t5a2a$f1u@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 170432199 references: <31EEACDA.64880EEB@sage.inel.gov> <4sq614$kai@mulga.cs.mu.OZ.AU> <4stagp$3vg@mulga.cs.mu.OZ.AU> <4t1s3n$chv@goanna.cs.rmit.edu.au> organization: Comp Sci, University of Melbourne newsgroups: comp.lang.ada Date: 1996-07-24T00:00:00+00:00 List-Id: dewar@cs.nyu.edu (Robert Dewar) writes: >Richard said > > True, Ada is so designed that sound and complete compile-time detection > of using uninitialised variables is impossible. > > But some day Ada will have a successor. And I can see no reason why that > successor should not do a better job than Ada in this respect. > >I doubt it, you certainly do not suggest what that better job might be. The >rest of your note talks about checking that is not and cannot be completely >statically reliable. I disagree. You keep saying that static checking cannot be completely reliable, but this is wrong -- you _can_ get reliable static checking. The down side is that in order to get it, you might have to accept some loss of expressiveness -- but you _can_ get it. For example, the language Sisal has a lot of support for arrays, but I'm pretty sure that in Sisal it's not possible to reference an uninitialized variable at run-time. Now there are probably some things you can do in Ada that you can't do in Sisal, but the restrictions enforced by the Sisal compiler are completely statically reliable. >Let's try to focus a specific example, the one I gave before, and you tell >me how your improved approach will work at compile time to detect as >illegalities all references to uninitialized elements. > >I have an array of 2 gigabytes in an allocate-on-demand environment. I use >this as a sparse hash table, but it is critical that only pages that are >actually used get referenced, so it is out of the question to initialize >the table. I don't understand how your sparse hash table works. Supposing you go to insert a new entry in the hash table, how do you detect a hash collision? Don't you have to initialize at least one field of the hash slots in order to tell whether each hash slot is occupied or not? How do you, as a programmer, know that your code will never reference any uninitialized slots of this hash table? If you can tell me that, then I might be able to figure out a reasonable way for you to tell the compiler the same information. -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.