🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #1106

Re: reassociation and undefined behaviour

#1106
From: Michael S
Date: Sat, 05 Dec 2026 18:40
37 lines
3351 bytes
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.

> 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.
> 
> 

Technical Details
Message-ID: <20261205204005.00006fe9@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-mail
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>

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 20:40:05 +0200
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <20261205204005.00006fe9@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>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 05 Dec 2026 18:40:04 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3186689"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19NgyuUE4KRI3po4QFzly6OT6Gw1f6UPfM="; posting-host="eec2e459ea6ea91de1920b0f3b02bbc3"
Cancel-Lock: sha1:GfZZza4EukhWGswYPYR9EkgKun4= sha256:aQvONHsBSHImNv7iRHH+16ZL7QELuehnLPc+a4+MXcQ=
	sha1:Fqmr2Iqt+2uSPwXtjsKhpEzoC2A= sha256:XZpdMd+RzuZgjNaObBZk+pRAtrb5RTZ3KeO2sHq4Qbk=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)