Article View: comp.arch
Article #1113Re: reassociation and undefined behaviour
From: Michael S
Date: Sat, 05 Dec 2026 21:01
Date: Sat, 05 Dec 2026 21:01
55 lines
4070 bytes
4070 bytes
On Sat, 5 Dec 2026 12:34:18 -0800 Stephen Fuld <sfuld@alumni.cmu.edu.invalid> wrote: > On 12/5/2026 10:40 AM, Michael S wrote: > > On Sat, 5 Dec 2026 09:53:36 -0800 > > Stephen Fuld <sfuld@alumni.cmu.edu.invalid> wrote: > > > >> On 12/5/2026 9:33 AM, Michael S wrote: > >>> On Fri, 4 Dec 2026 13:10:34 -0800 > >>> Stephen Fuld <sfuld@alumni.cmu.edu.invalid> wrote: > >>> > >>>> On 12/4/2026 11:29 AM, EricP wrote: > >> > >>>>> The reason I ask is because in my hobby language design I have 4 > >>>>> integer data types, signed and unsigned linear sint and uint > >>>>> with overflow checks, and signed and unsigned modulo smod and > >>>>> umod. If there is something wrong with the concept of an "smod" > >>>>> data type I wanted to know. But it sounds like smod is > >>>>> mathematically ok, though perhaps morally objectionable to some > >>>>> apple counters of the world. Later I added signed and unsigned > >>>>> saturating ssat and usat integer types. > >>>> > >>>> You might look at Ada as it supports mod data types. > >>> > >>> IIRC, not satisfactory. Programmer is givens no choice w.r.t. > >>> lower bound of the modulo range. In that particular regard, they > >>> are no better than unsigned types in C. > >> > >> So you want to have a data type that has a range of e.g. 2-7, and > >> when you add one to seven, you get 2? > > > > Yes. The most obvious practical case is -180 to 179. > > Even more useful for fixed-point (delta) types than for plain > > integers. > > Wow! I had missed the point that you said *signed* mod types. I can > see uses for that, but it does seem expensive to implement. Not at all. Relatively to the rather significant cost of not power-of-two ranges, additional cost required to make a base arbitrary is very small. And probably about the same for positive and negative bases. > > Can you talk a little about your language e.g. what is it designed > for, what other capabilities it has that other languages don't > provide, etc.? > > What in my posts get you an idea that I design languages? I do not.
Technical Details
Message-ID:
<20261205230137.0000657b@yahoo.com>Path:
mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cpqih$acf5$1@dont-email.me> <11ejtoe$eoj7$1@dont-email.me> <11el2c1$q43$1@reader2.panix.com> <11emcgn$1k681$1@dont-email.me> <jwvbj74bzm4.fsf-monnier+comp.arch@gnu.org> <11eolqn$2peg5$1@dont-email.me> <2026Dec2.132411@mips.complang.tuwien.ac.at> <11epd07$362ph$1@dont-email.me> <1796263648-5857@newsgrouper.org> <11ergn7$6utu$1@dont-email.me> <2026Dec3.122036@mips.complang.tuwien.ac.at> <1796326998-5857@newsgrouper.org> <11etu0b$1aih9$1@dont-email.me> <TlCQS.44884$7vt4.19168@fx07.iad> <2026Dec4.190839@mips.complang.tuwien.ac.at> <ewEQS.416856$Lt64.284338@fx41.iad> <11eva8b$21n86$1@dont-email.me> <20261205193318.00007f9f@yahoo.com> <11f1j30$34kqa$1@dont-email.me> <20261205204005.00006fe9@yahoo.com> <11f1sgc$39sup$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.arch Subject: Re: reassociation and undefined behaviour Date: Sat, 5 Dec 2026 23:01:37 +0200 Organization: A noiseless patient Spider Lines: 55 Message-ID: <20261205230137.0000657b@yahoo.com> References: <11cpqih$acf5$1@dont-email.me> <11ejtoe$eoj7$1@dont-email.me> <11el2c1$q43$1@reader2.panix.com> <11emcgn$1k681$1@dont-email.me> <jwvbj74bzm4.fsf-monnier+comp.arch@gnu.org> <11eolqn$2peg5$1@dont-email.me> <2026Dec2.132411@mips.complang.tuwien.ac.at> <11epd07$362ph$1@dont-email.me> <1796263648-5857@newsgrouper.org> <11ergn7$6utu$1@dont-email.me> <2026Dec3.122036@mips.complang.tuwien.ac.at> <1796326998-5857@newsgrouper.org> <11etu0b$1aih9$1@dont-email.me> <TlCQS.44884$7vt4.19168@fx07.iad> <2026Dec4.190839@mips.complang.tuwien.ac.at> <ewEQS.416856$Lt64.284338@fx41.iad> <11eva8b$21n86$1@dont-email.me> <20261205193318.00007f9f@yahoo.com> <11f1j30$34kqa$1@dont-email.me> <20261205204005.00006fe9@yahoo.com> <11f1sgc$39sup$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Sat, 05 Dec 2026 21:01:36 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3490012"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18E04CprtlCvEk02RC0TEag02myZHmOayY="; posting-host="eec2e459ea6ea91de1920b0f3b02bbc3" Cancel-Lock: sha1:FYL3h/peEYYcBi+3mGa5lNw1o4I= sha256:0SQND4L4lcqGOiwXNqKd8RcnLrGJqaOz2OwJspXOAko= sha1:KqyxuXquQQFQQSRqDiwRe/heICM= sha256:G4bDThQ7XmJNbabrdXuZEwlB4bSJAAK7wif62v82BLE= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)