From: "bklungle" <bklungle@ix.netcom.com>
Subject: Re: GNAT 3.10p and GCC 2.7.2.3
Date: 1998/02/08
Date: 1998-02-08T10:09:58-08:00 [thread overview]
Message-ID: <01bd34be$00c9d5e0$0e2915c0@p5120> (raw)
In-Reply-To: 34DDED2F.7AF4@arlington.net
Mike,
Maybe I misunderstood your reference to standard math function overloads
not working in gnat-3.10. The following was hacked quickly on 3.10 on NT.
Compiled and executed fine. Note the overload of "+" in Mtest from M. From
your comment, it sounds more like the data types of the new defining
functions were somehow mapping directly to the System defined ones, perhaps
from using a subtype declaration instead of a type. Just a guess on my
part.
Anyway, as I said, I may have misunderstood your statement.
cheers...bob
> Let me add to this thought, ...
>
> Overloading of basic arithmetic operators (+,-,>,<,mod,rem ...) which
> worked in GNAT Ada 3.07 and 3.09 doesn't work in 3.10. The compiler
> complained that it couldn't resolve ambiguous references for these
> operators between our file and 'System' even though the low level math
> operations were fully resolved within the boundaries of the file being
> compiled. Unfortunately, we have to overload the operators because of
> the peculiarities of the target machine (custom-built, embedded
> application). It's also a shame because v3.10's development environment
> looks really slick.
>
> Otherwise, well done GNAT.
>
> -=Michael Appleby=-
>
package M is
type int is new integer;
type flt is new long_float;
function "+"(a, b : int) return int;
function "+"(a, b : flt) return flt;
end M;
package body M is
function "+"(a, b : int) return int is
begin
return int(integer(a) + integer(b));
end "+";
function "+"(a, b : flt) return flt is
begin
return flt(long_float(a) + long_float(b));
end "+";
end M;
with M;
with Text_IO;
procedure Mtest is
function "+"(a, b : M.int) return M.int renames M."+";
a, b, c : M.int;
begin
a := 3;
b := 4;
c := a + b;
Text_IO.put_line(
"The value of" &
integer'image(integer(a)) &
" +" &
integer'image(integer(b)) &
" =" &
integer'image(integer(c))
);
end Mtest;
next prev parent reply other threads:[~1998-02-08 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-02-07 0:00 GNAT 3.10p and GCC 2.7.2.3 Robert B. Love
1998-02-07 0:00 ` Jean-Francois Vilarem
1998-02-10 0:00 ` Robert B. Love
1998-02-08 0:00 ` Michael Appleby
1998-02-08 0:00 ` bklungle [this message]
1998-02-09 0:00 ` 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