4 ms·
Rewrite as: for (ptr = start; random_condition (*ptr); ptr = ptr->next) { } Then anyone reading your code will know the empty loop was intentional. BTW, m
by WalterBright 10mo ago
Rewrite as:
for (ptr = start; random_condition (*ptr); ptr = ptr->next) { }
Then anyone reading your code will know the empty loop was intentional. BTW, many C compilers warn about the ; on a for loop.
Have you ever discovered this bug:
if (condition);
doThis();
It's a hard one to see in a code review. Yes, that's also disallowed in D.
> I should use %lld for long long, but the printf implementation shipped with the compiler doesn't support that.
Weird that your compiler would support long long, but with a broken Standard library. I don't see that as a feature. You can always cast the argument to long, and at least you won't get undefined behavior.
- 1718627440 10mo ago> Rewrite as: Could do that I just don't like the look. :-) > Have you ever discovered this bug: Actually no, because the coding style I use either puts it on a single line or with braces. I never indent just a single line. So: if (condition) doThis (); or: if (condition) { doThis (); } > Weird that your compiler would support long long, but with a broken Standard library. Yeah, for your information it was GCC combined with newlib for arm-none-eabi shipped with Debian/MS Windows.
- WalterBright 10mo ago> So or Those are not what I was mentioning. It was the use of ; immediately following for(). No loop body.
- 1718627440 10mo agoThat was the answer to your: > Have you ever discovered this bug: [...]