Sujet : Re: Loops (was Re: do { quit; } else { })
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 21. Apr 2025, 19:43:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250421113640.839@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-04-21, bart <
bc@freeuk.com> 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/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca