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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae9506fd4dcf7090 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-21 18:43:15 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!snoopy.risq.qc.ca!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DB4AD20.4070109@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Concatenation and Characters References: <44hp9.807$_u6.205@nwrddc01.gnilink.net> <3DA5AE5F.3030902@attbi.com> <3DB03EF1.EE771923@mmm.com> <3DB43EB0.AAF4B38C@mmm.com> <3DB44B9C.80007@worldnet.att.net> <3DB466CB.7CE0BC59@mmm.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 22 Oct 2002 01:42:26 GMT NNTP-Posting-Host: 63.184.8.202 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1035250946 63.184.8.202 (Mon, 21 Oct 2002 18:42:26 PDT) NNTP-Posting-Date: Mon, 21 Oct 2002 18:42:26 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30012 Date: 2002-10-22T01:42:26+00:00 List-Id: Programmer Dude wrote: > Upthread Preben Randhol wrote this: > > | with Ada.Text_IO; use Ada.Text_IO; > | > | procedure uninit is > | A : Integer; > | B : Integer := 2; > | begin > | > | if A > B then > | Put_Line ("A is greater than B"); > | else > | Put_Line ("B is greater than A"); > | end if; > | end uninit; > > Maybe my question is best stated thus: is there any correct implentation > of Ada that would allow this code to run? All correct implementations of Ada must compile and execute this program. Ada does not require default initialization of variables except for access variables, if we limit ourselves to elementary types. Ada does not require that compilers detect references to uninitialized variables. Ada does not require that references to uninitialized variables be detected at run time. Some compilers will warn you of references to uninitialized variables, but that is not required. In general, detecting all references to uninitialized variables during compilation, without ever incorrectly flagging a reference to an initialized variable, is impossible. Compilers that issue warnings usually only do so for "simple" cases. Ada is intended for embedded, real-time systems. The overhead of requiring default initialization of all variables may not be acceptable for such systems. This was especially true in the early 1980s when Ada was first being developed. Between the overhead of default initialization and the impossibility of detecting references to uninitialized variables, the language did not require such things. The revision process for the language has backwards compatibility as a major goal, so don't expect this to change. However, you might be interested in pragma Normalize_Scalars in the Safety and Security Annex (Annex H). If your compiler supports this Annex and you can accept the overhead, this pragma insures that scalars are default initialized to some value. When possible, this value will be out of range for the subtype. -- Jeff Carter "Your mother was a hamster and your father smelt of elderberries." Monty Python & the Holy Grail