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, WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,eeee7990df5d2c7,start X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Aritmetics on numeric types Date: 1999/06/12 Message-ID: #1/1 X-Deja-AN: 488768447 Content-Transfer-Encoding: 7bit References: Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Date: 1999-06-12T00:00:00+00:00 List-Id: Jan Kroken wrote in message news:vhi3dzx601l.fsf@sigrlinn.ifi.uio.no... > > I have this code: > > package Types is > type Score is range 0 .. 99999999999; for Score'Size use 64; > end Types; > > Points : Types.Score; pragma import(C,Score,"score"); > function C_Bind_Compute_Score(level,humans,moves:Interfaces.C.Int) > return Types.Score; > pragma import(C,C_Bind_Compute_Score,"c_bind_compute_score"); > .... > Points := C_Bind_Compute_Score(Level,Humans,Moves); > > > in C: > score c_bind_compute_score(int level, int humans, int moves){ > return points + > ((Score)sqrt(((level+1)*humans*10000)/(moves+1)))*(level+1); > } > > > > Now I want to eliminate the C function. But I don't know how to > do aritmetic operations on Types.Score. > Points := Points + ... resultet in > > game.adb:208:27: operator for type "Score" defined at types.ads:6 is not directly visible > game.adb:208:27: use clause would make operation legal > > I tried to add "use Types.Score", but that did not change anything. > > Help! You need to say use type Types.Score; This makes the primitive operations of Types.scope visible anywhere in the scope where the use clause appears, following its appearance.