thank
Printable View
thank
If you think about it for 0.45 seconds, you'll figure out how to do it.
It will take a lot longer to figure out why you think you want to.
Code:
for(;;)
Is there any advantage (I mean in terms of CPU efficiency etc) over doing:
Over something like:Over something like:Code:
for(;;)
Code:
while(1)
Since neither of them require any work, I'm pretty sure they would be exactly the same.
You probably did not enable optimisations, since modern compilers are smart enough to recognise that while(1) is an infinite loop and avoid evaluating its condition as a trivial optimisation.You probably did not enable optimisations, since modern compilers are smart enough to recognise that while(1) is an infinite loop and avoid evaluating its condition as a trivial optimisation.Quote:
Originally Posted by EOP
Another way is to use a do ... while(1), and yet another way is to use that language construct starting with g that I shall not speak of.
I find that for(;;) is the best though because with certain compilers on high warning levels you can get a warning about a conditional expression being constant with the while's.
You have to use two of those g statements if you wish to break out of that loop.
Code:
#include <stdio.h>
int main () {
label:
goto label ;
return 0;
}
*gasp* He dare speak such treacherous words in the form of example!?
Is this like Voldemort - aka, he whose name is not spoken?
iMalc said he would not speak of goto statements by name, so I ran with it. Then your very next post was a goto example. So perhaps we can call you Gotomort?:
COBOL Alter Verb
We now move on to the early COBOL ALTER verb that probably deserves the award for the worst programming language command.
When I learned COBOL in the late 80's I asked my teacher if we may use alter in structured programming - he got almost a heart attack. :)