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: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Representation clauses and side-efects on STM32F411 ravenscar runtime Date: Sun, 2 Aug 2015 13:31:15 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <55bddbe2$0$3384$426a74cc@news.free.fr> <87io8xlb3p.fsf@theworld.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 2 Aug 2015 20:29:42 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="ee44d3db9c41f5ad88d7e8e8f0268f05"; logging-data="25937"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/58KWTtTGki0i1DDvfg6LTChlnf4iOH7Q=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <87io8xlb3p.fsf@theworld.com> Cancel-Lock: sha1:Wwvll3snuZh6tJHgdOmfklvOl3k= Xref: number.nntp.giganews.com comp.lang.ada:194645 Date: 2015-08-02T13:31:15-07:00 List-Id: On 08/02/2015 12:54 PM, Bob Duff wrote: > "Jeffrey R. Carter" writes: > >> On 08/02/2015 01:59 AM, Frédéric Praca wrote: >>> >>> type Mantissa is range 0 .. 2**12 - 1 with Size => 12; >>> type Fraction is range 0 .. 2**4 - 1 with Size => 4; > >> Wouldn't modular types be better for these? > > Why would you want wraparound arithmetic for these? Seems like it would > just hide bugs. I wouldn't think you'd do any arithmetic with these. A modular type makes it clear you have an unsigned representation. -- Jeff Carter "Hold your temper. Count ten.... Now let 'er go. You got a good aim." Never Give a Sucker an Even Break 105