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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-19 08:00:52 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!feed2.news.rcn.net!rcn!news-out.visi.com!petbe.visi.com!uunet!ash.uu.net!spool0900.news.uu.net!reader0900.news.uu.net!not-for-mail Date: Mon, 19 May 2003 11:00:15 -0400 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030506 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Quality systems (Was: Using Ada for device drivers? (Was: the Ada mandate, and why it collapsed and died)) References: <9fa75d42.0305141747.5680c577@posting.google.com> <3ec4b1c9$1@news.wineasy.se> <9fa75d42.0305161748.1735fc32@posting.google.com> <4W%xa.28765$cK5.11964@nwrdny02.gnilink.net> <1053353256.804734@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1053356415.653253@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1053356426 reader0.ash.ops.us.uu.net 27559 204.253.250.10 Xref: archiver1.google.com comp.lang.ada:37515 Date: 2003-05-19T11:00:15-04:00 List-Id: Vinzent Hoefler wrote: > You don't seem to see the real problem. > Try that with binary values on a machine with one's complement. Try > that on a machine that throws an overflow error if the sign changes... > There is much more work involved to make it work correct than to > simply leave it implementation defined like in C. C and C++ define arithmetic on an unsigned types to be the conventional rules of modulo arithmetic, regardless of the underlying machine representation, so the compiler has to get it correct, regardless of what the hardware does. Testing for overflow is no big deal. If the machine doesn't give you a hardware check, you just check the inputs first. You can look up an old 68000 assembly language manual, for example, which described in detail how the V, C, O, and S flags were set for each arithmetic operation. > I still doubt that. And unless someone from the language designers can > definitely confirm that, I will keep doing so. Here's a quote from the Ada95 Rationale, The modular types are unsigned integer types which exhibit cyclic arithmetic. (They thus correspond to the unsigned types of some other languages such as C.)