Re: Please don't do this (code fragment)
On 13/01, elf@florence.buici.com wrote:
| int i;
| for (i = 0; i > -1; i += 1) {
| // ...
| if (terminal_condition)
| break;
| // ...
| }
[...]
| Moreover, i is never used. The loop could be reduced to
|
| while ((file = fts_read (dir)) != NULL) {
| // ...
| }
Those are not equivalent: the first loop, while ugly, has a guard against
endless looping if fts_read always returns non-NULL for any reason (not
knowing what fts_read contains, it is hard to tell whether there is a
reason for this or not).
Sam
Reply to: