From: mheaney@ni.net (Matthew Heaney)
Subject: operands of membership tests
Date: 1997/10/26
Date: 1997-10-26T00:00:00+00:00 [thread overview]
Message-ID: <mheaney-ya023680002610971750430001@news.ni.net> (raw)
A membership never raises Constraint_Error, but evaluation of its operands
might. Suppose I do this
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Fixed is
type Fixed is delta 1.0 range 0.0 .. 256.0;
for Fixed'Small use 1.0;
begin
Put (Boolean'Image (33_000.0 in Fixed));
end;
Let's suppose 33_000.0 isn't even in the base range of Fixed.
Can evaluation of the literal 33_000.0 raise Constraint_Error?
In RM83 11.6 (9), the note states that an implementation is allowed to
replace the expression with a constant value (in my example, False), even
though the operand is outside the base range of the type. What's the story
in Ada 95?
What's the more general case, for any relational operator? Under what
circumstances does evaluation of (numeric) literals raise Constraint_Error?
Under what circumstances can an implementation remove an expression it can
evaluate statically, containing (static) operands that are outside the base
range of the type?
--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271
next reply other threads:[~1997-10-26 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-10-26 0:00 Matthew Heaney [this message]
1997-10-26 0:00 ` operands of membership tests Robert Dewar
1997-10-26 0:00 ` Matthew Heaney
1997-10-27 0:00 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox