Possible Duplicate:
Is “for(;;)” faster than “while (TRUE)”? If not, why do people use it?
Why use the ugly for(;;) syntax instead of the slightly better looking while(true) loop?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no advantage to
for(;;)overwhile(1).Use
while(1), because it’s easier to comprehend (imho). I’ve never seen afor(;;)used before, and it may be confusing to others who view your code, and may wonder the same thing you just asked.EDIT: Here’s a link: while (1) Vs. for (;;) Is there a speed difference?
It basically says that they both generate the same code. In assembly, it’s
jmp ....