comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada.Containers Hash function for a set of small integers
Date: Mon, 26 Apr 2010 14:37:08 -0400
Date: 2010-04-26T14:37:08-04:00	[thread overview]
Message-ID: <wcchbmy6ox7.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: m2wrvxw0mg.fsf@pushface.org

Simon Wright <simon@pushface.org> writes:

>       type M is mod 2**31;
>       Result : M := 0;
>    begin
>       Result := Result xor Integer'Pos (I.A);

> and, before anyone rushes to check it out, yes, it fails with negative
> values and I'm about to file a bug against it.

I don't think that's a compiler bug.  Conversion of negative numbers
to modular raises Constraint_Error.  I think that's a language
design flaw, but not everyone agrees with me.  The 'Mod attribute
works around the problem.

- Bob



  reply	other threads:[~2010-04-26 18:37 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 [this message]
2010-04-26 21:05         ` Simon Wright
2010-04-26 21:50           ` Adam Beneschan
2010-04-27  4:50             ` AdaMagica
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