comp.lang.ada
 help / color / mirror / Atom feed
From: christoph.grein@eurocopter.com
Subject: Re: Choice of variant record discriminant (design question)
Date: 26 Oct 2005 06:14:31 -0700
Date: 2005-10-26T06:14:31-07:00	[thread overview]
Message-ID: <1130332471.078782.145370@g49g2000cwa.googlegroups.com> (raw)
In-Reply-To: m2acgwmpsu.fsf@hugin.crs4.it

Jacob Sparre Andersen wrote:
> I have declared a record type like this:
>
>    type Preprocessed_Parameters (Measurement_Count : Natural := 0) is
>       record
>          case Measurement_Count is
>             when 0 =>
>                null;
>             when others =>
>                Mean_Value      : Scalar;
>                Scaled_Variance : Scalar;
>          end case;
>       end record;
>
> I would like to return an object of that type from a function using
> this piece of code:
>
declare
  Parm: Preprocessed_Parameters (Measurement_Count => Count);
begin
>    if Count = 0 then
       null;
>    else
>       [...]
       Parm.Mean_Value := Mean;
       Parm.Scaled_Variance := Sum;
       return Parm;
>    end if;
> 
> I can't do this, since the discriminant has to be static.




  reply	other threads:[~2005-10-26 13:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-26 12:21 Choice of variant record discriminant (design question) Jacob Sparre Andersen
2005-10-26 13:14 ` christoph.grein [this message]
2005-10-26 13:26   ` Jacob Sparre Andersen
2005-10-26 17:52 ` Jeffrey R. Carter
2005-10-26 19:52 ` Randy Brukardt
2005-10-31 15:53   ` Jacob Sparre Andersen
replies disabled

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