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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,72d0d0a56877b2ed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-26 07:03:53 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Ada83 or DEC Ada: Feature or bug? Date: 26 Sep 1994 08:54:44 -0400 Organization: Courant Institute of Mathematical Sciences Message-ID: <366gak$i75@gnat.cs.nyu.edu> References: <360ecv$kq1@hacker.demon.co.uk> NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1994-09-26T08:54:44-04:00 List-Id: In Ada 83, you declare an unsigned value like this: type x is range 0 .. 2**32 - 1; whether your compiler accepts this or not is up to the implementation (trying to use this on many compilers won't work, but that's not a feature of Ada 83, merely a (nasty) shortcoming of the implementation). Note that you won't get wrap around arithmetic with this type, if you want wrap around arithmetic, then you have to program it, or also check with your implementor to see if they provide support for unsigned types (both Dec and Alsys provide some support in separate packages -- other vendors may too). If your compiler rejects the above declaration, and if your vendor does not provide any support for unsigned arithmetic in separate packages you are out of luck. This is the same situation as the guy who wanted 64-bit signe arithmetic maybe being out of luck if his compiler did not support it. Trying to use 32-bit signed for 32-bit unsigned is very unlikely to be satisfactory. Suppressing checks may work, but many compilers don't do all possible suppression (it's not required), and you are then writing erroneous programs which may or may not work. Note that Ada 94 has mcuh better support for unsigned. Any reasonable Ada 84 compiler will provide support for 32-bit unsigned arithmetic in a convenient form: type unsigned is mod 2 ** 32; as you might guess from this declaration, the arithmetic is the normal wrap around (2's complement representation) unsigned arithmetic.