Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.c Subject: Re: Loops (was Re: do { quit; } else { }) Date: Mon, 21 Apr 2025 18:43:40 -0000 (UTC) Organization: A noiseless patient Spider Lines: 40 Message-ID: <20250421113640.839@kylheku.com> References: <20250413072027.219@kylheku.com> <87ecxmv4t4.fsf@nosuchdomain.example.com> <20250420200823.908@kylheku.com> Injection-Date: Mon, 21 Apr 2025 20:43:40 +0200 (CEST) Injection-Info: dont-email.me; posting-host="c13f5017c98192b6c07a0b629837b649"; logging-data="2953068"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/nCEOd6SrvBqHuTLD00sXEtdl8WhMRNRE=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:aIaTdHChMsaaLuL9+FdAuANRiWo= On 2025-04-21, bart wrote: > On 21/04/2025 04:16, Kaz Kylheku wrote: > > - Because they are not gathered in one place, not only is it less> > readable, but we cannot use while write a macro such as: >> >> for_sqlite_hash (p, &pSchema->trigHash) { >> if (some_condition_over(p)) >> continue; // doesn't stupidly repeat for the same p! >> } > > I can't write such macros at all. I'm not even sure what this does. Have you never worked with a large codebase written by someone other than you? When you open a random file in an unfamiliar code base, pretty much any function call that is not in the standard library triggers the "I don't know what this does" response. You have to learn some of that program's definitions in order to effectively work with that program. At least those which are relevant to your intended task. You set up your "jump to definition" editor-fu and start reading. A loop macro like for_sqlite_hash (p, &pSchema->trigHash) is so obvious that the only reason you'd look at its definition is to confirm that it's not doing something stupid (which can be defined as just about anything different from what it *looks* like it is doing). > I'd call that a win! Now you're calling the inability of the programmer to implement a nice space-saving notation over something verbose a "win". If so, why isn't "for (a; b; c)" also a "win" over "do i = x, y". -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca