comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com (Gautier)
Subject: Re: Disriminant question - Waiting desperately for solution :-(
Date: 13 Mar 2003 05:13:00 -0800
Date: 2003-03-13T13:13:00+00:00	[thread overview]
Message-ID: <17cd177c.0303130513.46ee216a@posting.google.com> (raw)
In-Reply-To: mailman.17.1047534648.308.comp.lang.ada@ada.eu.org

Grein, Christoph:

> No, your analysis is quite wrong. L_Tern is defined without discriminant
> in this example, so only its _default_ value is None, but it may change.
> So the assignmant to L_Tern should work.

Thank you (and sorry for the wrong information).
I learnt again something about Ada.
In that case L_Term can change discriminant when it wants - strange!
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!
___
PS: I couldn't resist to test - maybe the OP should start with a
simplified example and complicate it until the bug is picked...

with Ada.Text_IO; use Ada.Text_IO;

procedure Discri is

  type T_Leg_Type is (Df, Tf, Lif, Tp, Ppos, None);

  type T_Fix is new Integer;
  
  type T_Term (Leg_Type : T_Leg_Type := None) is
  record
    case Leg_Type is
      when Df | Tf | Lif | Tp =>
        Fix : T_Fix;
      when Ppos | None =>
        null;
    end case;
  end record;

  L_Term : T_Term;

begin
  Put_Line( T_Leg_Type'image(L_Term.Leg_Type) );
  L_Term := ( Leg_Type => Tf,  Fix => 0);
  Put_Line( T_Leg_Type'image(L_Term.Leg_Type) );
  L_Term := ( Leg_Type => Ppos );
  Put_Line( T_Leg_Type'image(L_Term.Leg_Type) );
  L_Term := ( Leg_Type => Df,  Fix => 0);
  Put_Line( T_Leg_Type'image(L_Term.Leg_Type) );
  Put_Line("Survived !");
end;



  reply	other threads:[~2003-03-13 13:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-13  5:40 Disriminant question - Waiting desperately for solution :-( Grein, Christoph
2003-03-13 13:13 ` Gautier [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-07  7:09 Disriminant question prashna
2003-03-07 11:17 ` Lutz Donnerhacke
2003-03-07 16:46   ` Matthew Heaney
2003-03-12  9:25     ` Disriminant question - Waiting desperately for solution :-( prashna
2003-03-12 16:12       ` Gautier
replies disabled

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