From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b2923d60cb81694b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Unsigned Integer Restraint Errors References: <1173712032.183064.264340@8g2000cwh.googlegroups.com> <1173726806.656979.305660@8g2000cwh.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1173755617 12.201.97.213 (Tue, 13 Mar 2007 03:13:37 GMT) NNTP-Posting-Date: Tue, 13 Mar 2007 03:13:37 GMT Organization: AT&T ASP.att.net Date: Tue, 13 Mar 2007 03:13:37 GMT Xref: g2news1.google.com comp.lang.ada:14502 Date: 2007-03-13T03:13:37+00:00 List-Id: 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