comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Discriminant as default initial value
Date: 1997/03/29
Date: 1997-03-29T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680002903972307160001@news.ni.net> (raw)
In-Reply-To: 333DB640.59EA@sirinet.net


In article <333DB640.59EA@sirinet.net>, Scott Renfro <srenfro@sirinet.net>
wrote:

>I want to use a discriminant in a record as both a bound in the index
>constraint of a component declaration and as a default initial value. 
>I'm not sure that this is allowed by the RM.

I'm curious: why are you setting the component Max to the value of the
discriminant?  Do you ever want to change Max?  If not, then why not just
read the discriminant directly (and get rid of the Max component)?

>The following example, while contrived, exhibits behavior that I
>definitely do not understand.  Using GNAT 3.09 for NT with Max defined
>before the Position Matrix, the component record is initialized as
>expected.  When Max is defined after the Position Matrix within the
>record, Max is initialized to a large value that is not even within the
>subtype's range.  No exception is raised.

This seems a bit strange.  The location of the components within the record
should not make any difference.  (Yes, there are some restrictions wrt
variant parts, but that doesn't apply here.)

Matt

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  reply	other threads:[~1997-03-29  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-29  0:00 Discriminant as default initial value Scott Renfro
1997-03-29  0:00 ` Matthew Heaney [this message]
1997-03-30  0:00   ` Scott Renfro
1997-03-30  0:00 ` Bob Klungle
1997-03-30  0:00   ` Robert Dewar
1997-03-31  0:00     ` Bob Klungle
1997-03-31  0:00       ` Robert Dewar
1997-03-31  0:00 ` Jon S Anthony
1997-03-31  0:00   ` Robert Dewar
1997-04-02  0:00   ` Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1997-03-30  0:00 Kees de Lezenne Coulande
1997-03-30  0:00 ` Robert Dewar
1997-04-02  0:00 Kees de Lezenne Coulande
1997-04-02  0:00 ` Robert Dewar
1997-04-07  0:00   ` Keith Thompson
1997-04-02  0:00 ` Scott Renfro
1997-04-02  0:00   ` Robert Dewar
replies disabled

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