comp.lang.ada
 help / color / mirror / Atom feed
From: Wilhelm Spickermann <zulo.20.unbenutzbar@spamgourmet.com>
Subject: Re: Uninitialized variable and the effects they have
Date: Thu, 24 Nov 2005 17:33:22 +0100
Date: 2005-11-24T17:33:22+01:00	[thread overview]
Message-ID: <dm4q0i$n9c$1@ulysses.news.tiscali.de> (raw)
In-Reply-To: dm41j1$epv$1@sunnews.cern.ch

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





      parent reply	other threads:[~2005-11-24 16:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-24  9:36 Uninitialized variable and the effects they have Maciej Sobczak
2005-11-24 11:49 ` Martin Dowie
2005-11-24 16:33 ` Wilhelm Spickermann [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox