They produce identical code. There are several reasons why you might prefer for (;;) , but all this is just a personal preference:
Some compilers will warn you about conditions that are always true. for(;;) will not have this problem.
for (;;) literally reads โJust loop forever!โ, while while (true) still has some sort of condition.
I say, choose one and stick to it. It doesnโt matter if you do not switch between them arbitrarily.
source share