thank
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.
Is there any advantage (I mean in terms of CPU efficiency etc) over doing:
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.Originally Posted by EOP
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
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.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
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; }
Mainframe assembler programmer by trade. C coder when I can.
*gasp* He dare speak such treacherous words in the form of example!?
Is this like Voldemort - aka, he whose name is not spoken?
Mainframe assembler programmer by trade. C coder when I can.
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?
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
I know it's off topic, but here's an even more unspeakable command:
http://www.gavilan.edu/csis/language...l#_Toc76036283COBOL 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.