Re:Why did I spend 1.5 months creating a Gameboy emulator? (...
by a_e_k on Thursday May 24, 2018 @12:10AM
(#17141022)
When I tested this in the distant past, I found that all the compilers I tried generated exactly the same assembly for both loops.
I've seen it said that "The most optimizing compiler is the most normalizing compiler." [1] The infinite loop structure is pretty easy to normalize.
The only real difference that I saw was that some compiler front ends would produce warnings that the condition in the while loop was always true, where they seemed to assume the empty for must be intentional.
Re:Why did I spend 1.5 months creating a Gameboy emulator? (...
by souprock on Wednesday May 23, 2018 @07:38PM
(#17139477)
The compiler won't care unless you "#define true 0".
The "for(;;)" loop is easier and faster for the human to parse. It stands out in source code.
With the "while(true)", you have to pay attention. It could be "while(tnie)" or "while(trua)". Whenever you see it, you have to read carefully.
The compiler probably optimizes the condition check out, so I doubt it really matters.