From: "Vinzent Hoefler" <nntp-2010-09@t-domaingrabbing.de>
Subject: Re: Fixed point constants issue
Date: Tue, 14 Sep 2010 20:28:51 +0200
Date: 2010-09-14T20:28:51+02:00 [thread overview]
Message-ID: <op.vi1cadcjd20q5n@jellix.jlfencey.com> (raw)
In-Reply-To: i6n66u$3rg$1@news.eternal-september.org
On Tue, 14 Sep 2010 08:54:20 +0200, J-P. Rosen <rosen@adalog.fr> wrote:
> Every language with overloading has to decide whether resolution goes
> from the outside to the inside, or the other way round. In the case of
> Ada, it is the "enclosing context" that determines the type of what's in
> it. If the enclosing context is a type conversion, it tells nothing
> about the expected type of its argument, hence the fall back to
> universal types. If the enclosing context is typed, it determines the
> type of the "*" operator.
I understand that. What I don't understand is that two different compilers
do
seem to handle it differently. Actually, I just wanted to know which one
does
it wrong. ;)
Now, to make matters worse:
ARM 3.5(9):
"[...] the evaluation of the range evaluates these simple_expressions
in an arbitrary order, and converts them to the type of the range."
which I read as "_first_ evaluate and _then_ convert". But this only
applies to
the dynamic case, right?
Then:
ARM 3.5(5):
"For a subtype_indication containing a range_constraint, [...], the type
of the
range shall resolve to that of the type determined by the subtype_mark of
the
subtype_indication. For a range of a given type, the simple_expressions of
the range
(likewise, the simple_expressions of the equivalent range for a
range_attribute_reference) are expected to be of the type of the range."
Which is quite specific and seems to happen here.
Yet, this is not the end:
ARM 3.5.9(3) defines a fixed point definition to have a
"real_range_specification",
which according to ARM 3.5.7(5) "is expected to be of any real type; the
types
need not be the same".
Now, I suspect that in
type Fixed_1 is delta 0.5 range 0.0 .. 50.0 * 0.1;
subtype Fixed_2 is Fixed_1 range 0.0 .. 50.0 * 0.1;
(where "One_Tenth" shall be a non-static function).
Fixed_1 and Fixed_4 have a range of 0.0 .. 5.0 then, whilst Fixed_2's
range suddenly
is 0.0 .. 0.0 again, right?
Vinzent.
--
There is no signature.
next prev parent reply other threads:[~2010-09-14 18:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-13 17:27 Fixed point constants issue Vinzent Hoefler
2010-09-13 18:04 ` Dmitry A. Kazakov
2010-09-13 18:25 ` Vinzent Hoefler
2010-09-13 19:05 ` Niklas Holsti
2010-09-13 20:35 ` Vinzent Hoefler
2010-09-13 20:35 ` Jeffrey Carter
2010-09-13 21:06 ` Vinzent Hoefler
2010-09-14 5:39 ` Niklas Holsti
2010-09-24 14:43 ` Markus Schöpflin
2010-09-24 20:05 ` Vinzent Hoefler
2010-09-24 21:38 ` Jeffrey Carter
2010-09-24 22:42 ` Vinzent Hoefler
2010-09-25 0:16 ` Jeffrey Carter
2010-09-27 10:33 ` Markus Schöpflin
2010-09-27 18:57 ` Jeffrey Carter
2010-09-28 8:16 ` Markus Schöpflin
2010-09-28 17:28 ` Jeffrey Carter
2010-10-05 6:27 ` Randy Brukardt
2010-10-05 18:40 ` Jeffrey Carter
2010-09-27 17:58 ` Adam Beneschan
2010-09-13 20:32 ` Dmitry A. Kazakov
2010-09-13 21:08 ` Vinzent Hoefler
2010-09-14 6:54 ` J-P. Rosen
2010-09-14 18:28 ` Vinzent Hoefler [this message]
2010-09-14 7:47 ` Dmitry A. Kazakov
2010-09-14 17:42 ` Vinzent Hoefler
2010-09-15 8:35 ` Dmitry A. Kazakov
2010-09-15 17:24 ` Vinzent Hoefler
2010-09-15 20:11 ` Dmitry A. Kazakov
2010-09-14 19:44 ` Keith Thompson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox