Possible Duplicate:
Is “for(;;)” faster than “while (TRUE)”? If not, why do people use it?
I been reading a programming book(java) there the author uses for(;;)
instead of while(true)
. This thing realy starts to annoy me so I thought I should check which is the best to use and if there are any diffrences. Here are the possible infinite loops:
for(;;){
}
while(true){
}
do{
}while(true)
- Which is preferble to use?
- Is there any diffrences in preformance (like you have to test if true is true in the while case) or are they compiled to the same thing?