Article View: comp.arch
Article #1105Re: reassociation and undefined behaviour
From: Stephen Fuld
Date: Sat, 05 Dec 2026 17:53
Date: Sat, 05 Dec 2026 17:53
30 lines
3138 bytes
3138 bytes
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? If so, then you are right that Ada doesn't provide that. But has more capability than C in that at least it provides mod with upper bounds not n*256. -- - Stephen Fuld (e-mail address disguised to prevent spam)
Technical Details
Message-ID:
<11f1j30$34kqa$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>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 09:53:36 -0800 Organization: A noiseless patient Spider Lines: 30 Message-ID: <11f1j30$34kqa$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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 05 Dec 2026 17:53:37 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3298122"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2URhDz/2Sp+m61U1OyRVjO8tgNb5C/Lg="; posting-host="145239e2f591b0e12cbc7808bb153b7b" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:3AbSvNBNGWqDsi82pYruqBurUtY= sha256:8H0E17kFAlzwyyB0jXiIlemjEYMCvVITrxyJoy3YLlQ= sha1:0kLl/scxSa+mbfuvV1S9wA94Ke4= sha256:K3ZE+yOnwDSIe8zXniCVMKWYwUON/pHrfczUDgFWses= Content-Language: en-US In-Reply-To: <20261205193318.00007f9f@yahoo.com>