Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Loops (was Re: do { quit; } else { }) Date: Thu, 17 Apr 2025 12:55:31 -0700 Organization: None to speak of Lines: 100 Message-ID: <87fri6pnpo.fsf@nosuchdomain.example.com> References: <20250415053852.166@kylheku.com> <20250416142925.663@kylheku.com> <20250416164536.110@kylheku.com> <87ikn3zg18.fsf@nosuchdomain.example.com> <87fri68w2c.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Thu, 17 Apr 2025 21:55:34 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ce66778584175375d620efc7d3b77de7"; logging-data="1342439"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//1D3mwCevGKzaZiHeUET9" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:kqbGUEZ7p2PEciArtmXWZXORkv8= sha1:+PAsBtiI78U3I03G7I/TughJ7z8= Xref: csiph.com comp.lang.c:392659 bart writes: > On 17/04/2025 19:47, Keith Thompson wrote: >> bart writes: > >>> Or maybe you can tell me where I can buy a computer (not some board >>> with an embedded microcontroller) where a C compiler for it has an >>> 'int' type other than 32 bits (with either fewer bits, or more!). >> Not the point. It's about what "int" *means*. It doesn't mean "a >> 32-bit integer". >> >>> At present it only seems to bother you. Since if it REALLY bothered >>> anyone here, nobody would be using 'int'; they'd be using int32_t or >>> long, unless they're happy that their int values and intermediate >>> calculations would be using only 16 bits. >> POSIX and Windows both guarantee that int is at least 32 bits wide, >> and >> it's perfectly reasonable to rely on those guarantees on those platforms. >> It would be so easy for you to get this right, but you don't even >> acknowledge the possibility that I might have a valid point. > > It's an obscure, pedantic point. I'd say that I disagree, but I don't feel the need to make the same point repeatedly. > A better one is that if considering only Windows and POSIX (what about > MacOS or Android?), then you admit int will be 32 bits (at least, but > I'm not holding my breath for 64). MacOS and Android are both POSIX-based systems. > That means that if either of those OSes are implied, then we can > assume that 'int' means a 32-byte to near 100% likelihood. In this context, neither of those OSes was implied. The discussion was about the semantics of for loops, applicable to all C implementations (and all implementations of the other languages that crept into the discussion). And POSIX requires int to be *at least* 32 bits wide, though systems with int wider than 32 bits are rare. > That saves thousands of posters having to qualify every reference to > 'int' with '[on POSIX or Windows]' or 'when it is exactly 32 bits'. Most references to int do not depend on its width. For contexts where it does matter, like the remark that has triggered this subthread, you can just say "32-bit int". Here's what you wrote upthread: What's far more useful is that it naturally works with i64 so has limits 4 billion times bigger than you get with C's default 'int' type. Here's what you could have written: What's far more useful is that it naturally works with i64 so has limits 4 billion times bigger than you get with 32-bit int. That's clearer, shorter, and correct, and would have avoided this entire subthread. I would not have commented on it. > That would be ironic if they have been making that assumption in their > source code for years and decades, where it would be critical, but are > not allowed to do so on long-running Usenet discusssions where it > doesn't really matter. > > So, like you get tired of my keeping on defending my stances from > attacks on multiple fronts, I get tired of having remember that some > specialised hardware that runs C may have a 16-bit int or something > equally unusual. All you have to remember is what C says about int. You already knew that C only requires to be at least 16 bits. I do not believe for a moment that you weren't aware of that. > In that case, why don't I save time by stating: > > * Whenever I mention 'int' type in the context of C, it means the > 32-bit type > > * If I intend it to mean anything other than that, I will say so. Again, if you had just said "32-bit int", there wouldn't have been a problem. And again, you refuse to acknowledge that I might have a valid point, something you've repeatedly demanded from others (and failed to acknowledge when it actually happens). "int" is a technical term defined by the C standard. If you deliberately use it incorrectly, you're going to get some pushback. It's difficult to avoid the conclusion that that's exactly what you want. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */