comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Aritmetics on numeric types
Date: 1999/06/12
Date: 1999-06-12T00:00:00+00:00	[thread overview]
Message-ID: <bJ3mcLNt#GA.203@newstoo.hiwaay.net> (raw)
In-Reply-To: vhi3dzx601l.fsf@sigrlinn.ifi.uio.no


Jan Kroken <jankr@nntp.ifi.uio.no> 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.







       reply	other threads:[~1999-06-12  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <vhi3dzx601l.fsf@sigrlinn.ifi.uio.no>
1999-06-12  0:00 ` David C. Hoos, Sr. [this message]
1999-06-12  0:00   ` Aritmetics on numeric types 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