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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: 64-bit unsigned integer? Date: Wed, 28 Feb 2018 02:17:51 -0800 Organization: A noiseless patient Spider Message-ID: <877eqxe7u8.fsf@nightsong.com> References: <421d1598-68d7-4d0b-b596-6e9c59cf865c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="57604df02d5d52e05bfe3cdcd917bb45"; logging-data="5246"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OhyaKtLwS9pQXmEDANpw+" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cancel-Lock: sha1:6tnyagy1gBGuIq7JP9jlk2OyCj0= sha1:0qLa9nb41pwHC/RJmTu+9vTEUcg= Xref: reader02.eternal-september.org comp.lang.ada:50702 Date: 2018-02-28T02:17:51-08:00 List-Id: "Randy Brukardt" writes: > The problem is simply one of language definition; there is no way in > the Ada language to get overflow for an unsigned type... These days, > we're moving away from adding any more kinds of types; everything new > will be a library much like the containers That seems unfortunate. I hope the libraries can be implemented in a way that don't cause runtime overhead. C unsigned ints wrap around but that is bogus since it kills the invariant that n+1 is always greater than n. GHC has a Word type that wraps around, for when you want wraparound, but Integers are (arbitrary precision) integers. (Plus there is also an evil and unsafe machine-word Int type). Having an unsigned int type that 1) uses all the bits in the machine word, and 2) errors on overflow, plus a separd Word type that wraps around, seems like the right way to do things. Oh well.