From: "Jeffrey R. Carter" <jrcarter@acm.org>
Subject: Re: Unsigned Integer Restraint Errors
Date: Tue, 13 Mar 2007 03:13:37 GMT
Date: 2007-03-13T03:13:37+00:00 [thread overview]
Message-ID: <BFoJh.14542$PF.8157@attbi_s21> (raw)
In-Reply-To: <et4cma$o0v$1@jacob-sparre.dk>
Randy Brukardt wrote:
>
> Ada has signed, checked integers, and unsigned, unchecked integers. It
> doesn't have unsigned, checked integers. That omission is only a problem if
> you need checked, maximum range unsigned integers; usually, you should just
> use an appropriate signed integer type:
From one point of view, Ada has signed, checked integers:
type Signed_Checked_Byte is range -128 .. 127;
unsigned, checked integers:
type Unsigned_Checked_Byte is range 0 .. 255;
for Unsigned_Checked_Byte'Size use 8;
(with the limitation that the upper bound can't exceed System.Max_Int,
which is generally < System.Max_Binary_Modulus - 1);
signed, unchecked integers:
type Signed_Unchecked_Byte is range -128 .. 127;
pragma Suppress (Overflow_Check, On => Signed_Unchecked_Byte);
and unsigned, unchecked integers:
type Unsigned_Unchecked_Byte is mod 256;
It seems odd that we use a different syntax for 1 of the 4 (yes, I
understand that the implications of modular types go beyond the lack of
overflow checks).
--
Jeff Carter
"That was the most fun I've ever had without laughing."
Annie Hall
43
next prev parent reply other threads:[~2007-03-13 3:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-12 15:07 Unsigned Integer Restraint Errors frikk
2007-03-12 16:27 ` Georg Bauhaus
2007-03-12 17:17 ` Adam Beneschan
2007-03-12 17:23 ` Adam Beneschan
2007-03-12 18:11 ` frikk
2007-03-12 20:00 ` frikk
2007-03-12 20:07 ` Adam Beneschan
2007-03-12 18:00 ` Dmitry A. Kazakov
2007-03-12 19:00 ` Martin Krischik
2007-03-12 21:13 ` Dmitry A. Kazakov
2007-03-12 19:13 ` frikk
2007-03-12 19:22 ` Randy Brukardt
2007-03-13 3:13 ` Jeffrey R. Carter [this message]
2007-03-13 3:00 ` Randy Brukardt
2007-03-13 12:09 ` frikk
2007-03-13 14:58 ` frikk
2007-03-13 15:31 ` frikk
2007-03-13 15:59 ` Robert A Duff
2007-03-13 16:18 ` Dmitry A. Kazakov
2007-03-13 16:21 ` Jeffrey R. Carter
2007-03-13 16:04 ` Adam Beneschan
2007-03-13 16:41 ` Adam Beneschan
2007-03-13 16:42 ` Adam Beneschan
2007-03-14 14:06 ` frikk
2007-03-13 17:23 ` Dmitry A. Kazakov
2007-03-13 17:31 ` Adam Beneschan
2007-03-14 0:54 ` Jeffrey R. Carter
2007-03-16 13:38 ` frikk
2007-03-13 16:16 ` Jeffrey R. Carter
2007-03-12 21:04 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox