Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Is this defined behavior? Date: Sat, 03 Feb 2024 13:41:10 -0800 Organization: None to speak of Lines: 35 Message-ID: <87zfwhmdjd.fsf@nosuchdomain.example.com> References: <7h8vN.323427$xHn7.112429@fx14.iad> <8734uaq19p.fsf@nosuchdomain.example.com> <8634ua9bts.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="026cbd12272797f54d5c091ea0e8c8d6"; logging-data="3473395"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gIiwfeF10mF2wzI4mHNrX" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:oxNiakcq+L8PVMDH+6+bjjejYNQ= sha1:FRnY7JF1gEkkbNx6ZjXAVESmngk= Xref: csiph.com comp.lang.c:381707 Malcolm McLean writes: > On 03/02/2024 08:44, Tim Rentsch wrote: >> Keith Thompson writes: >>> Anthony Cuozzo writes: >>>> Time T: Add N to a uintptr_t >>>> >>>> Time T+1: Subtract N from that same uintptr_t >>>> >>>> Questions: >>>> >>>> 1. Is this behavior defined? >>> >>> Sure, why wouldn't it be? uintptr_t is just an unsigned integer >>> type. The guarantees about converting to and from void* don't >>> affect its arithmetic behavior. Adding and then subtracting N >>> yields the original value. >> Extremely likely to hold. A perverse implementation could choose >> (IIANM) a uintptr_t whose integer conversion rank is less than >> that of int, and that could mess things up. In practical terms >> though what you say is spot on. > > OK, so this is completely topical and there's no issue there. But it's > also fair to say that it's the sort of post which gives the newgroup a > bad reputation. > > I'm not going to take a position. But since we've had complaints about > the diection things are going in, other people might like to weigh in > on this. What on Earth are you talking about? -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Medtronic void Void(void) { Void(); } /* The recursive call of the void */