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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e6dde7d957da14ec X-Google-Attributes: gid103376,public From: Sazonov Cyril Subject: Re: What's with GNAT? Date: 1996/12/27 Message-ID: #1/1 X-Deja-AN: 206356326 distribution: all sender: news@ssrun.arcom.spb.su organization: RIKC SZRGC keywords: data conversion newsgroups: comp.lang.ada x-return-path: geol!geol.spb.su!cyril@bulldozer.arcom.spb.su Date: 1996-12-27T00:00:00+00:00 List-Id: BwB wrote us: ................. > the GNAT compiler for the SUN (sorry, I don't know the version--I'm not sure > they do either!). But the problem seems to come from the conversion of an > "out" parameter. The GNAT compiler says the statement wil raise > CONTRAINT_ERROR, and if a program is executed it does indeed raise it. Since > I am not familiar enough with GNAT, I offered to post this question for them. .................................. > What are missing about GNAT? .................................. > procedure Multiply ( Left, Right : in Global.Cartesian_Vector; > Result : out Global.Cartesian_Vector ); .................................. > > procedure Multiply ( Left, Right : in Global.NED_Vector; > Result : out Global.NED_Vector ); > begin -- Multiply > Multiply ( Global.Cartesian(Left), Global.Cartesian(Right), > Global.NED_Vector(Result) ); > -------------------^^^^^^^^^^^^^^^^^^^^^^^^^ >-------------------- claims it will raise CONSTRAINT_ERROR--and does! > end Multiply; I suppose you are missing about the _language_, but not _GNAT_. It seems me that the thing is that the reurned result is of Global.Cartesian_Vector type even though the variable Result is of Global.NED_Vector and the type conversion is to be done _before_ assignment, perfomed by the result return. So you are to use an intermediate variable to be able to _get_ the wanted result and the cjnvert it. For example: procedure Multiply ( Left, Right : in Global.NED_Vector; Result : out Global.NED_Vector ); INTERIM : Global.Cartesian_Vector; begin -- Multiply Multiply ( Global.Cartesian(Left), Global.Cartesian(Right), INTERIM ) ; Result := Global.NED_Vector ( INTEGRIM ) ; end Multiply; Happy New Year ! Best wishes from Russia ! Cyril Sazonov