When implementing an infinite loop, is there a difference in using while(1) vs for(;;) vs goto?
Thanks, Chenz
In C, true is implemented as follows (depending on compiler)
#define TRUE 1
or
#define TRUE (-1)
AND false is implemented as
#define FALSE 0
so while (1) is equivalent to while (true) since 0 is considered false.
the while (1) == for (; ;) as there are no stopping condition.
which is translated to assembler as
:loop
...
...
...
goto loop
so if the assembler code doesn't have a ret or exit instruction, it's considered a infinite loop.