Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
while (1) vs. for ( ;; )
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Charlie Gordon, post: 2426314"] I agree completely, as I explain it in the very same post. There isn't so much "well-written" code out there ;-) Well-written code definitely has to adhere to strict Coding Rules. Among these is a golden one: consistency. This means in particular that simple constructs should be implemented the same way everywhere. Coding Rules should define the "standard" way to implement indefinite loops, be it for(;;), while(1), while(true) FOREVER... and the programmer is required to use whatever was decided. I personnally read a lot of code, well-written and not: in my experience, something that looks like a while (1) can sometimes be a while (l), so I am extra careful with these, while (1) makes me suspicious. It is a matter of style, but also of maturity: I have oserved that skilled experienced programmers tend to use for (;;) more than while (1), whereas beginners will think of while(! done) and java natives will prefer while (true). while (1) comes a distant second in this list. This is a statistical approach, one of many that help figuring the skill level of the programmer when code proofing: I don't look for the same kind of bugs in beginner's code and in expert's code. And there will be bugs: C has pitfalls for all levels. Chqrlie. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
while (1) vs. for ( ;; )
Top