comp.lang.ada
 help / color / mirror / Atom feed
From: robert_dewar@my-dejanews.com
Subject: Re: Fixed point multiplication ambiguity
Date: 1999/01/28
Date: 1999-01-28T00:00:00+00:00	[thread overview]
Message-ID: <78q6al$hi5$1@nnrp1.dejanews.com> (raw)
In-Reply-To: F696u2.Cp.0.-s@inmet.camb.inmet.com

In article <F696u2.Cp.0.-s@inmet.camb.inmet.com>,
  stt@houdini.camb.inmet.com (Tucker Taft) wrote:

> The whole fixed-point multiplication model is pretty
> obscure, unfortunately.

I agree with Tuck's analysis in its entirety. Note that
the model may be a bit obscure, but the normal practice
of qualifying intermediate results returned by
multiplication using an explicit conversion removes
this obscurity.

I actually find the implicit use of Duration MOST
unfortunate. GNAT finds it worrying enough to emit a
warning:

  1. procedure Tf is
  2.     D : Duration := 5.0;
  3.     Dec_Delt : Integer := Integer (D * 10.0 + 0.5)
                                                 |
   >>> warning: Universal-fixed expression interpreted as
       type "Standard.Duration"

  4. begin
  5.    null;
  6. end;

Since it really seems strange to have Duration creeping
in here. Note that this is NOT related to the declaration
of D as being of type Duration, it would happen if D were
of some other fixed point type, as long as it was not a
visible type at the point of the expression.

If two fixed-point types *are* visible, then GNAT says

  1. procedure Tf2 is
  2.     type r is delta 1.0 range -10.0 .. +10.0;
  3.     D : r := 5.0;
  4.     Dec_Delt : Integer := Integer (D * 10.0 + 0.5);
                                                 |
     >>> ambiguous universal_fixed_expression
     >>> possible interpretation as type Standard.Duration"
     >>> possible interpretation as type "r" defined at
         line 2

     5. begin
     6.    null;
     7. end;

It could still confuse a beginner :-) but it is hard to
see how one can do better error-message wise!


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-01-28  0:00 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-14  0:00 Fixed point multiplication ambiguity Marc A. Criley
1999-01-14  0:00 ` Robert I. Eachus
1999-01-14  0:00 ` Matthew Heaney
1999-01-14  0:00 ` Tucker Taft
1999-01-15  0:00   ` robert_dewar
1999-01-28  0:00   ` Nick Roberts
1999-01-28  0:00     ` Tucker Taft
1999-01-28  0:00       ` robert_dewar [this message]
1999-01-29  0:00       ` Nick Roberts
1999-01-29  0:00         ` Tucker Taft
1999-01-29  0:00           ` Nick Roberts
1999-01-29  0:00             ` Tucker Taft
1999-02-01  0:00               ` Robert I. Eachus
1999-02-02  0:00               ` Building a compiler (was: Fixed point multiplication ambiguity) Nick Roberts
1999-02-03  0:00                 ` Chris Morgan
1999-02-04  0:00                   ` robert_dewar
1999-02-04  0:00                     ` Garbage collection - was " news.oxy.com
1999-02-04  0:00                       ` robert_dewar
1999-02-05  0:00                         ` Tom Moran
1999-02-05  0:00                         ` David Botton
1999-02-18  0:00                         ` news.oxy.com
1999-02-18  0:00                           ` Garbage collection - was Re: Building a compiler Samuel Mize
1999-02-19  0:00                             ` Samuel Mize
1999-02-18  0:00                           ` Garbage collection - was Re: Building a compiler (was: Fixed point multiplication ambiguity) David Botton
1999-02-18  0:00                           ` dewar
1999-02-18  0:00                           ` AdaHag
1999-02-19  0:00                           ` Steven Hovater
1999-02-20  0:00                           ` A Modest Defense of ACT (though they are big boys and can take care of themselves) Steve Quinlan
1999-02-21  0:00                             ` dewar
1999-02-22  0:00                               ` Matthew Heaney
1999-02-21  0:00                                 ` bill
1999-02-22  0:00                                   ` Larry Kilgallen
1999-02-22  0:00                                 ` dennison
1999-02-22  0:00                             ` dennison
1999-02-24  0:00                               ` Steve Quinlan
1999-02-25  0:00                                 ` dennison
1999-02-26  0:00                                   ` Steve Quinlan
1999-02-26  0:00                                     ` dennison
1999-02-27  0:00                                       ` Simon Wright
1999-02-27  0:00                                         ` Dave Taylor
1999-02-28  0:00                                       ` dewar
1999-02-25  0:00                                 ` dewar
1999-02-25  0:00                                   ` Steve Quinlan
1999-02-25  0:00                                     ` robert_dewar
1999-02-05  0:00                     ` GC+HC for GNAT/GCC (was: Building a compiler) Nick Roberts
     [not found]                       ` <m33e4jvs1n.fsf@muc.de>
1999-02-06  0:00                         ` GC+FSD for GNAT/GCC Nick Roberts
1999-02-07  0:00                           ` robert_dewar
1999-02-05  0:00                   ` Building a compiler Nick Roberts
1999-02-05  0:00                     ` Tucker Taft
1999-02-06  0:00                       ` Nick Roberts
1999-02-03  0:00                 ` Building a compiler (was: Fixed point multiplication ambiguity) dennison
1999-01-30  0:00             ` Fixed point multiplication ambiguity robert_dewar
1999-02-02  0:00               ` Building a compiler (was: Fixed point multiplication ambiguity) Nick Roberts
1999-02-03  0:00                 ` Tucker Taft
1999-02-03  0:00                 ` robert_dewar
1999-01-28  0:00     ` Fixed point multiplication ambiguity robert_dewar
1999-01-14  0:00 ` Tom Moran
1999-01-14  0:00 ` bob
1999-01-14  0:00 ` David C. Hoos, Sr.
replies disabled

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