comp.lang.ada
 help / color / mirror / Atom feed
* Missing **-operator in GNAT 3.14?
@ 2002-04-02  8:56 Anders Råberg
  2002-04-02 11:14 ` David C. Hoos, Sr.
  0 siblings, 1 reply; 8+ messages in thread
From: Anders Råberg @ 2002-04-02  8:56 UTC (permalink / raw)


Hi all,

I'm trying to compile a program that contains the follwing code: 


    --- mypack.ads ---

    1: with Interfaces;
    2:
    3: package Mypack is
    4:   type Short is new Interfaces.Integer_16;
    5: end Mypack;

    ------------------



    --- mytest.ads ---

    1: with Mypack;
    2:
    3: package Mytest is
    4:    subtype My_Short is Mypack.Short;
    5:
    6:    function "*" (A, B : in My_Short) return My_Short renames
Mypack."*";
    7:
    8:    function "**" (A, B : in My_Short) return My_Short renames
Mypack."**";
    9: end Mytest;

    -----------------

    % gcc -c mytest.ads
    mytest.ads:8:63: operator for type "Short" is not declared in
"Mypack"


When I compile the program with GNAT 3.13, 3.12 etc. it works perfectly
fine, but when I use 3.14 I get the error stated above. Has the 
**-operator been removed or have I missed something?


Regards,
	Anders

-- 
----------------------------------------------------------------------
Anders R�berg, M.Sc. C.S&E                
Software Systems Engineer                  
Ericsson Microwave Systems AB, Sweden
----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing **-operator in GNAT 3.14?
  2002-04-02  8:56 Missing **-operator in GNAT 3.14? Anders Råberg
@ 2002-04-02 11:14 ` David C. Hoos, Sr.
  2002-04-02 16:18   ` Robert Dewar
  0 siblings, 1 reply; 8+ messages in thread
From: David C. Hoos, Sr. @ 2002-04-02 11:14 UTC (permalink / raw)


The renaming declarations are unneccessary because those operators
are implicitly declared for all integer types.

That this is so is evidenced by the successful compilation and
execution of the following program (with the renaming declarations
in Mytest commented out):

with Ada.Text_IO;
with Mypack;
with Mytest;
procedure Main is
   use type Mypack.Short;
   Value : Mypack.Short := 3 ** 4;
   My_Value : Mytest.My_Short := 4 ** 5;
begin
   Ada.Text_IO.Put_Line (Value'Img);
   Ada.Text_IO.Put_Line (My_Value'Img);
end Main;

The fact that "*", and "**" are treated differently by GNAT looks
like a "bug" to me, though, and you should probably report it
to report@gnat.com


----- Original Message -----
From: "Anders R�berg" <anders.raberg@NO.SPAM.PLEASE.emw.ericsson.se>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: April 02, 2002 2:56 AM
Subject: Missing **-operator in GNAT 3.14?


> Hi all,
>
> I'm trying to compile a program that contains the follwing code:
>
>
>     --- mypack.ads ---
>
>     1: with Interfaces;
>     2:
>     3: package Mypack is
>     4:   type Short is new Interfaces.Integer_16;
>     5: end Mypack;
>
>     ------------------
>
>
>
>     --- mytest.ads ---
>
>     1: with Mypack;
>     2:
>     3: package Mytest is
>     4:    subtype My_Short is Mypack.Short;
>     5:
>     6:    function "*" (A, B : in My_Short) return My_Short renames
> Mypack."*";
>     7:
>     8:    function "**" (A, B : in My_Short) return My_Short renames
> Mypack."**";
>     9: end Mytest;
>
>     -----------------
>
>     % gcc -c mytest.ads
>     mytest.ads:8:63: operator for type "Short" is not declared in
> "Mypack"
>
>
> When I compile the program with GNAT 3.13, 3.12 etc. it works perfectly
> fine, but when I use 3.14 I get the error stated above. Has the
> **-operator been removed or have I missed something?
>
>
> Regards,
> Anders
>
> --
> ----------------------------------------------------------------------
> Anders R�berg, M.Sc. C.S&E
> Software Systems Engineer
> Ericsson Microwave Systems AB, Sweden
> ----------------------------------------------------------------------
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
>





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing **-operator in GNAT 3.14?
  2002-04-02 11:14 ` David C. Hoos, Sr.
@ 2002-04-02 16:18   ` Robert Dewar
  2002-04-02 16:42     ` David C. Hoos
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Dewar @ 2002-04-02 16:18 UTC (permalink / raw)


"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> wrote in message news:<mailman.1017746102.31836.comp.lang.ada@ada.eu.org>...

> The fact that "*", and "**" are treated differently by 
> GNAT looks like a "bug" to me, though, and you should 
> probably report it to report@gnat.com

Nothing to report here, the diagnostic is correct! If
some earlier version of GNAT accepted this, it was a bug
in that earlier version, since the code is wrong.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing **-operator in GNAT 3.14?
  2002-04-02 16:18   ` Robert Dewar
@ 2002-04-02 16:42     ` David C. Hoos
  2002-04-02 17:11       ` Sergey Koshcheyev
  0 siblings, 1 reply; 8+ messages in thread
From: David C. Hoos @ 2002-04-02 16:42 UTC (permalink / raw)


I do not dispute the correctness of the diagnostic, but what I am
curious about is why the diagnostic complains about "**", but
doesn't complain about "*".

What is the difference between these two operators, in this context?

David Hoos

----- Original Message -----
From: "Robert Dewar" <dewar@gnat.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Tuesday, April 02, 2002 10:18 AM
Subject: Re: Missing **-operator in GNAT 3.14?


> "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> wrote in message
news:<mailman.1017746102.31836.comp.lang.ada@ada.eu.org>...
>
> > The fact that "*", and "**" are treated differently by
> > GNAT looks like a "bug" to me, though, and you should
> > probably report it to report@gnat.com
>
> Nothing to report here, the diagnostic is correct! If
> some earlier version of GNAT accepted this, it was a bug
> in that earlier version, since the code is wrong.
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing **-operator in GNAT 3.14?
@ 2002-04-02 17:07 Robert Dewar
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Dewar @ 2002-04-02 17:07 UTC (permalink / raw)


<<I do not dispute the correctness of the diagnostic, but what I am
curious about is why the diagnostic complains about "**", but
doesn't complain about "*".
>>

Because a matching "*" is declared but no matching "**" 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing **-operator in GNAT 3.14?
  2002-04-02 16:42     ` David C. Hoos
@ 2002-04-02 17:11       ` Sergey Koshcheyev
  2002-04-03  1:02         ` Robert Dewar
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Koshcheyev @ 2002-04-02 17:11 UTC (permalink / raw)


"David C. Hoos" <david.c.hoos.sr@ada95.com> wrote in message
news:mailman.1017765842.8487.comp.lang.ada@ada.eu.org...
> What is the difference between these two operators, in this context?
>
> David Hoos

The difference apparently lies in this:
7. The highest precedence exponentiation operator ** is predefined for every
specific integer type T with the following specification:
8. function "**"(Left : T; Right : Natural) return T
(http://www.ada-auth.org/arm-html/RM-4-5-6.html)

So the second operand of "**" has to be of type Natural, regardless of the
type of the first operand.

Sergey.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing **-operator in GNAT 3.14?
  2002-04-02 17:11       ` Sergey Koshcheyev
@ 2002-04-03  1:02         ` Robert Dewar
  2002-04-03  3:51           ` Steve Doiel
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Dewar @ 2002-04-03  1:02 UTC (permalink / raw)


"Sergey Koshcheyev" <serko84@hotmail.com> wrote in message news:<a8con5$2emm$1@ns.felk.cvut.cz>...
> So the second operand of "**" has to be of type Natural, 
> regardless of the type of the first operand.

Good going Sergey, I was wondering when someone might
actually look up the declaration of "**". After all the
diagnostic said that no matching "**" was declared, you
would think the first reaction would be to go look at the
declared "**" and see why it does not match :-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Missing **-operator in GNAT 3.14?
  2002-04-03  1:02         ` Robert Dewar
@ 2002-04-03  3:51           ` Steve Doiel
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Doiel @ 2002-04-03  3:51 UTC (permalink / raw)


"Robert Dewar" <dewar@gnat.com> wrote in message
news:5ee5b646.0204021702.bb04357@posting.google.com...
> "Sergey Koshcheyev" <serko84@hotmail.com> wrote in message
news:<a8con5$2emm$1@ns.felk.cvut.cz>...
> > So the second operand of "**" has to be of type Natural,
> > regardless of the type of the first operand.
>
> Good going Sergey, I was wondering when someone might
> actually look up the declaration of "**". After all the
> diagnostic said that no matching "**" was declared, you
> would think the first reaction would be to go look at the
> declared "**" and see why it does not match :-)

Gee.  If I didn't know better I would think you were a professor who makes
his students think (and gives positive feedback when someone getss it right)
 :-)

SteveD






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-04-03  3:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02  8:56 Missing **-operator in GNAT 3.14? Anders Råberg
2002-04-02 11:14 ` David C. Hoos, Sr.
2002-04-02 16:18   ` Robert Dewar
2002-04-02 16:42     ` David C. Hoos
2002-04-02 17:11       ` Sergey Koshcheyev
2002-04-03  1:02         ` Robert Dewar
2002-04-03  3:51           ` Steve Doiel
  -- strict thread matches above, loose matches on Subject: below --
2002-04-02 17:07 Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox