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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8982dc345b43855 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!newsfeed.freenet.de!news.tiscali.de!not-for-mail From: Wilhelm Spickermann Newsgroups: comp.lang.ada Subject: Re: Uninitialized variable and the effects they have Date: Thu, 24 Nov 2005 17:33:22 +0100 Organization: Tiscali Germany Usenet Message-ID: References: NNTP-Posting-Host: p83.129.0.150.tisdip.tiscali.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: ulysses.news.tiscali.de 1132850003 23852 83.129.0.150 (24 Nov 2005 16:33:23 GMT) X-Complaints-To: abuse@tiscali.de NNTP-Posting-Date: Thu, 24 Nov 2005 16:33:23 +0000 (UTC) User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:6594 Date: 2005-11-24T17:33:22+01:00 List-Id: Maciej Sobczak wrote: > Is the behaviour of this program well-defined? > I mean - I consider it to be well defined if it's guaranteed > that exactly one of the branches is chosen and later statements > are executed without any restrictions. > I don't think so. ("No", in the sense of your definition) Referencing an uninitialized variable may raise Program_Error. As it is a scalar, it is guaranteed to be a legal (= belonging to the subtype) or illegal value of the type otherwise. You can use I'VALID to find out which one it is and this usage of the variable "I" will never raise Program_Error. But if you don't do that, Constraint_Error may be raised when executing the case-statement or sometime later. (provided there are any bit patterns in the representation which do not belong to subtype Integer). So it is not "undefined behaviour" in the sense of "anything may happen". Wilhelm