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,a2a089cd92fbc353 X-Google-Attributes: gid103376,public From: robert_dewar@my-dejanews.com Subject: Re: Uninitialized Variables Date: 1999/01/25 Message-ID: <78iljo$7q7$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 436772367 References: X-Http-Proxy: 1.0 x6.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Jan 25 20:53:17 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-01-25T00:00:00+00:00 List-Id: In article , rracine@draper.com (Roger Racine) wrote: > One of the few areas where Ada programs exhibit non-deterministic behavior > (i.e. different behavior for different runs) is when variables are not set > before their use. > > I am curious as to why the language designers did not > think this was sufficiently common enough of an error to > protect against it. I understand that having an initial > value takes more memory and more CPU, but so do > constraint checks. You miss the philosophical and design objections to junk initial values. These arguments are familiar so I won't repeat them in detail here! > And there could always have been a pragma to allow > uninitialized variables (akin to pragma SUPPRESS). Ada 95 of course has a pragma, but it has the opposite sense, you use pragma Normalize_Scalars if you want initializations. The intention of this pragma is precisely to avoid non-determinism. Why is it not enough for you? > Does anyone know why there is not at least a required > link-time warning message for variables possibly used > before being set? First, a full analysis at link time of all possible static flows through a program would be a very heavy burden to place on a compiler. It is far out of reach of what could be done in existing implementation frameworks, and I would have significant efficiency concerns. Second, requiring warning messages is a big bogus in anyway. Such requirements are not testable, and not well-defined. I think it reasonable to let the marketplace determine the need for warnings. It is certainly useful for a compiler to do a reasonable job of detecting obvious cases (try using -gnatwu with GNAT 3.11p). Robert Dewar -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own