Article View: comp.arch
Article #1112Re: reassociation and undefined behaviour
From: Stephen Fuld
Date: Sat, 05 Dec 2026 20:34
Date: Sat, 05 Dec 2026 20:34
41 lines
3658 bytes
3658 bytes
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. 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.? -- - Stephen Fuld (e-mail address disguised to prevent spam)
Technical Details
Message-ID:
<11f1sgc$39sup$1@dont-email.me>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>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: Stephen Fuld <sfuld@alumni.cmu.edu.invalid> Newsgroups: comp.arch Subject: Re: reassociation and undefined behaviour Date: Sat, 5 Dec 2026 12:34:18 -0800 Organization: A noiseless patient Spider Lines: 41 Message-ID: <11f1sgc$39sup$1@dont-email.me> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 05 Dec 2026 20:34:21 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3470297"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191uET6HbO4L5zhLRuMZ34ba0K0YBoQOjc="; posting-host="145239e2f591b0e12cbc7808bb153b7b" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:eNhZPCvByCpJHKxtHA0pPCd3rAk= sha256:4xw8G5LsqVBYaxXAFBxZz9x65oCedSY+cw54TFVH0NQ= sha1:5G2nNXkgySKUCROXlKG2V89PGBk= sha256:mOK9o/bIX34la960fnonlvOgUICkABvTvl4QVQI1eKs= In-Reply-To: <20261205204005.00006fe9@yahoo.com> Content-Language: en-US