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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-19 08:22:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!213.200.246.247!not-for-mail From: Vinzent Hoefler Newsgroups: comp.lang.ada Subject: Re: Quality systems (Was: Using Ada for device drivers? (Was: the Ada mandate, and why it collapsed and died)) Date: Mon, 19 May 2003 17:21:05 +0200 Organization: JeLlyFish software Message-ID: References: <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> <1053356415.653253@master.nyc.kbcfp.com> NNTP-Posting-Host: 213.200.246.247 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: fu-berlin.de 1053357729 28356959 213.200.246.247 (16 [175126]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:37521 Date: 2003-05-19T17:21:05+02:00 List-Id: Hyman Rosen wrote: >Vinzent Hoefler wrote: > >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. ACK. But you do not seem to recognize the fact that C was simply designed around a specific hardware. Most computers to modulo arithmetic and the only reason C permits an overflow exception on signed types is that some hardware exists that might raise such an exception in such a case. There was *never* the idea to have some kind of overflow check in C-programs, the standard was simply dictated by the fact that some machines do it and they wanted to have C-support on them. The same applies to the shift operator. The only reason it is not perfectly defined for signed types is that some machine just know a logical and no arithmetic shift or vice versa. >Testing for overflow is no big deal. Sure, I know my condition codes, thank you. The fact remains, there are no overflow checks in C. The one that *might* occur for signed types is just a hardware dictated incident. >> 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.) Well, "they ... correspond". Quite a difference, and especially when you read on, it is quite clear that C just comes out as an example for a broader concept. Most CPU's simply use modular arithmetic internally and that is the only reason this is the (only) default in C. And some other languages. Vinzent. --=20 Parents strongly cautioned -- this posting is intended for mature audiences over 18. It may contain some material that many parents would not find suitable for children and may include intense violence, sexual situations, coarse language and suggestive dialogue.