comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christoph.grein@eurocopter.com>
Subject: Re: Ada.Containers Hash function for a set of small integers
Date: Mon, 26 Apr 2010 21:50:19 -0700 (PDT)
Date: 2010-04-26T21:50:19-07:00	[thread overview]
Message-ID: <c58085a3-0964-420b-be6c-5b5f22caff9c@s9g2000yqa.googlegroups.com> (raw)
In-Reply-To: 06f5335a-f686-4af1-893a-55517abe8d1a@s21g2000pri.googlegroups.com

> >          Result := Result xor M (Integer'Pos (X) mod 2**31);
> >          --  No warning (and executes as I had expected)
> >          Put_Line ("result:" & M'Image (Result));
> >       exception
> >          when others => Put_Line ("exception c");
> >       end;
> about the zero divisor. The Aonix ObjectAda 7.2 compiler ...
> gives an error at the third block (95LRM4.9(35)).

I'm no language lawyer, but I'll give it a try.

RM95 4.9(35): If the expression is not part of a larger static
expression, then its value shall be within the base range of its
expected type. Otherwise, the value may be arbitrarily large or small.

RM TC1 AM1 4.9(35/2) {AI95-00269-01} If the expression is not part of
a larger static expression *and the expression is expected to be of a
single specific type*, then its value shall be within the base range
of its expected type. Otherwise, the value may be arbitrarily large or
small.

Since Aonix quotes 95RM4.9(35), it must be a pure Ada95 compiler.
2**31 is not part or a larger static expression. The further condition
of being of a single specific type (which is not the case here, the
expected type is any integer type) was added later.

So Aonix is correct, and so is GNAT, if the latter is new enough to
obey AM1.



  reply	other threads:[~2010-04-27  4:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 23:26 Ada.Containers Hash function for a set of small integers Michael R
2010-04-23  1:39 ` John B. Matthews
2010-04-23 21:39 ` Simon Wright
2010-04-23 22:47   ` Michael R
2010-04-24 11:28     ` Simon Wright
2010-04-26 18:37       ` Robert A Duff
2010-04-26 21:05         ` Simon Wright
2010-04-26 21:50           ` Adam Beneschan
2010-04-27  4:50             ` AdaMagica [this message]
2010-04-27 19:04               ` Simon Wright
2010-04-27 19:08             ` Simon Wright
2010-04-23 23:08   ` Jeffrey R. Carter
2010-04-26 15:33   ` Warren
2010-04-26 18:14     ` Jeffrey R. Carter
2010-04-26 18:32       ` Charmed Snark
2010-05-05  4:29   ` Yannick Duchêne (Hibou57)
2010-05-06 15:46     ` Warren
replies disabled

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