* Ada.Containers.Vectors
@ 2017-06-26 16:39 hnptz
2017-06-26 18:06 ` Ada.Containers.Vectors Per Sandberg
2017-06-27 6:15 ` Ada.Containers.Vectors G.B.
0 siblings, 2 replies; 3+ messages in thread
From: hnptz @ 2017-06-26 16:39 UTC (permalink / raw)
Here is my code:
with Ada.Containers; use Ada.Containers;
with Ada.Containers.Vectors;
package RGF is
package IV is new Vectors(Natural,Integer);
use IV;
procedure GenerateRGF(m : Integer;
f : in out Vector);
end RGF;
package body RGF is
use IV;
procedure GenerateRGF(m : Integer;
f : in out Vector) is
done : Boolean := False;
fmax : Vector;
j : Integer;
begin
for i in 1..m loop
f(i):=1;
fmax(i) := 2;
end loop;
while not done loop
j := m+1;
loop
j := j-1;
exit when f(j) /= fmax(j);
end loop;
if j > 1 then
f(j) := f(j)+1;
for i in j+1 .. m loop
f(i):=1;
if f(j) = fmax(j) then
fmax(i):=fmax(j)+1;
else
fmax(i):=fmax(j);
end if;
end loop;
else
done := True;
end if;
end loop;
end GenerateRGF;
end RGF;
As a result I get "ambiguous operands for equality" for /= and =. How to resolve these ambiguities?
Best,
Gilbert
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Ada.Containers.Vectors
2017-06-26 16:39 Ada.Containers.Vectors hnptz
@ 2017-06-26 18:06 ` Per Sandberg
2017-06-27 6:15 ` Ada.Containers.Vectors G.B.
1 sibling, 0 replies; 3+ messages in thread
From: Per Sandberg @ 2017-06-26 18:06 UTC (permalink / raw)
Hi
A answer is that the compiler don't know if it should use the "=" for
"Constant_Reference_Type'(F (J)))" or "Integer'(F (J))".
Its a bit like:
---------------------------------------
procedure put(Item : Integer);
procedure put(Item : Long_Integer);
procedure put(Item : Long_Long_Integer);
----------------------
And then in the code:
put(2);
-- This wont compile you have to state one of the following:
put(Integer'(2));
put(Long_Integer'(2));
put(Long_Long_Integer'(2));
/Per
Den 2017-06-26 kl. 18:39, skrev hnptz@yahoo.de:
> Here is my code:
>
> with Ada.Containers; use Ada.Containers;
> with Ada.Containers.Vectors;
> package RGF is
> package IV is new Vectors(Natural,Integer);
> use IV;
> procedure GenerateRGF(m : Integer;
> f : in out Vector);
> end RGF;
>
> package body RGF is
> use IV;
> procedure GenerateRGF(m : Integer;
> f : in out Vector) is
> done : Boolean := False;
> fmax : Vector;
> j : Integer;
> begin
> for i in 1..m loop
> f(i):=1;
> fmax(i) := 2;
> end loop;
> while not done loop
> j := m+1;
> loop
> j := j-1;
> exit when f(j) /= fmax(j);
> end loop;
> if j > 1 then
> f(j) := f(j)+1;
> for i in j+1 .. m loop
> f(i):=1;
> if f(j) = fmax(j) then
> fmax(i):=fmax(j)+1;
> else
> fmax(i):=fmax(j);
> end if;
> end loop;
> else
> done := True;
> end if;
> end loop;
> end GenerateRGF;
>
> end RGF;
>
> As a result I get "ambiguous operands for equality" for /= and =. How to resolve these ambiguities?
>
> Best,
>
> Gilbert
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Ada.Containers.Vectors
2017-06-26 16:39 Ada.Containers.Vectors hnptz
2017-06-26 18:06 ` Ada.Containers.Vectors Per Sandberg
@ 2017-06-27 6:15 ` G.B.
1 sibling, 0 replies; 3+ messages in thread
From: G.B. @ 2017-06-27 6:15 UTC (permalink / raw)
On 26.06.17 18:39, hnptz@yahoo.de wrote:
> As a result I get "ambiguous operands for equality" for /= and =. How to resolve these ambiguities?
A bit of a guess, it might be that the message is not
obviously about resolving equality; if I rewrite
exit when f.element(j) /= fmax(j);
...
and
if f.element(j) = fmax(j) then
...
then my compiler responds differently. If implicit_dereference of
holders is going on under the hood, this all might be an effect
of a new feature, and the message could be improved by your
compiler maker.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-27 6:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26 16:39 Ada.Containers.Vectors hnptz
2017-06-26 18:06 ` Ada.Containers.Vectors Per Sandberg
2017-06-27 6:15 ` Ada.Containers.Vectors G.B.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox