Liste des Groupes | Revenir à cl c |
On 20/04/2025 17:46, Janis Papanagnou wrote:On 20.04.2025 13:43, bart wrote:On 20/04/2025 11:18, Janis Papanagnou wrote:>On 19.04.2025 15:05, bart wrote:>
But overloading in the form of 30-40 integer types to represent the 8
types i8-i64 and u8-u64, plus the 16 different combinations of writing
'unsigned long long int', and so on, is fine. As are the dozens
(hundreds?) of macros in stdint.h/inttypes.h.
I haven't said this "is fine". It wasn't at all the topic here.
Sorry, I forgot the rules. [...]
In C? I don't recall any examples in C that could be written without 'for'.
It makes not much sense to spread them across a multi-line block
of statements. - If you haven't ever experienced that, and still
cannot see and understand that if explained to you, then I can't
help you.[*]
Here's the example you snipped:
for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){
sqlite3DeleteTrigger(db, (Trigger*)sqliteHashData(p));
}
In my opinion, that for-header is too complex. You can barely make out
the condition (that lonely 'p' which you have to hunt for).
The point is that if you have programming elements that are
related to a loop construct (initialization, exit condition,
update for next iteration) it makes sense to keep them together.
So what about this then (another example you snipped):
for(p=sqliteHashFirst(&pSchema->trigHash); p; sqlite3DeleteTrigger(db,
(Trigger*)sqliteHashData(p)), p=sqliteHashNext(p));
It keeps it even more together, which you seem to like.
[...]
I think it is YOU whose brain is so bound to having just the ONE kind of
loop to do half a dozen different jobs, none of them well.
[...]
Why do you again make
up things. - The point is to keep things together that belong
together.
Why are you so crazy about putting everything onto one line? [...]
You're
saying that:
ONE; TWO; THREE
is always better than:
ONE;
TWO;
THREE;
[...]
This is an example which I started off trying to simplify:
for (monthIdx = 0; monthIdx < 12 && yearDay >=
yearDays[leapYear][monthIdx]; monthIdx++) ;
I simply can't see it.
So the first step is to turn it into a while loop:
monthIdx = 0;
while (monthIdx < 12 && yearDay >= yearDays[leapYear][monthIdx])
monthIdx++;
Now at least I can see the condition! I'm sorry, but if prefer the
original, then I don't want to have to debug or maintain your code.
[...]
I just don't get the love. Or maybe, nobody here (perhaps apart from
Keith) is willing to admit that there's anything wrong with 'for'.
[...]
Les messages affichés proviennent d'usenet.