[chuck-dev] for loop, empty conditional statement, possible fix

Kassen signal.automatique at gmail.com
Fri Oct 23 09:31:59 EDT 2009


Hey Szilveszter!

(you know, I'm a programmer myself :))
>

You wouldn't say! ;-)



> I'm a C programmer, and in C, I often write an infinite loop like this:
> for(;;) {}
>
> I prefer for() loops to while() loops, because for loops have the ability
> to step the cycle variable even if you put a continue; in them.
>
> Ok, I see. This makes sense and it makes sense to follow C. I'm going to
adopt that trick as well, though for infinite loops that will never break or
continue I'll stick to "while(true)" as that's still more readable to me.

So, to be perfectly clear, (as a programmer I like to try and see the
structure,) this particular case of a condition is a exception in that it
can now be empty, with empty being seen as "not explicitly false and hence
true" and this does not hold true for other conditions such as -say- empty
clauses in "if" and "while" loops?

Thanks,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-dev/attachments/20091023/73864eb9/attachment.html>


More information about the chuck-dev mailing list