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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!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 1173802567 12.201.97.213 (Tue, 13 Mar 2007 16:16:07 GMT) NNTP-Posting-Date: Tue, 13 Mar 2007 16:16:07 GMT Organization: AT&T ASP.att.net Date: Tue, 13 Mar 2007 16:16:07 GMT Xref: g2news1.google.com comp.lang.ada:14515 Date: 2007-03-13T16:16:07+00:00 List-Id: Randy Brukardt wrote: > > And the supposedly unchecked signed type is not unchecked in any useful > way...the only difference might be to remove code generated to make checks, > and that isn't even guaranteed. > > Randy. > > (*) ISO published the Amendment on March 9th. So Ada 95 is now > obsolete...and "Ada" includes the Amendment. Yes, I should have said "Ada 95", since I haven't looked at everything in the new standard yet, specifically suppressing checks. Now that I have looked at that section, I see that Ada (used properly this time) no longer has a way to specify a desire for unchecked, signed integer types (except Annex J). Suppressing overflow checks in general is not the same thing. It may take me time to get used to the name change; at least I'm not writing 2006 for the date anymore ... Perhaps if we were starting from scratch we could do something like type T is range Min .. Max; If Min is negative, T'Base is a signed type; otherwise, T'Base is an unsigned type. There would be a pragma, something like pragma Unchecked_Integer (T); which would give T'Base the semantics of an Ada modular type if T'Base is unsigned. It would have a similar effect if T'Base is signed, which could be defined in Ada terms as unchecked converting the value to a modular type of the same size, performing operations with that modular type, and unchecked converting back to T'Base. I just made this up, so I'm sure there are things I haven't considered. I'm assuming 2s-complement signed integers, for one thing. -- Jeff Carter "If you don't get the President of the United States on that phone, ... you're going to have to answer to the Coca-Cola Company." Dr. Strangelove 32