Hello,
I am kinda new to C++ and have a couple of ?s:
what does for(;;) mean ??
the usual way I have seen is for (int i =1; i<2, i++) .
Also, I have encountered the term "stubs", what are these??
Finally, what are daemons??
Thanks for the help!
This is a discussion on loops ? within the C++ Programming forums, part of the General Programming Boards category; Hello, I am kinda new to C++ and have a couple of ?s: what does for(;;) mean ?? the usual ...
Hello,
I am kinda new to C++ and have a couple of ?s:
what does for(;;) mean ??
the usual way I have seen is for (int i =1; i<2, i++) .
Also, I have encountered the term "stubs", what are these??
Finally, what are daemons??
Thanks for the help!
for(;;) is an infinite loop. There is no initialization, no end condition, and no increment.
This is similar to a while(1) loop, which is a more common way of doing the same thing.
I suppose the reason that you see for(;;) in text books is to show that each of these paramaters is optional.
The following are from FOLDOC:
daemon
stub
[EDIT]
You have to include a way to get out of the empty for-loop. You can use break; Or, return; if you want to exit the loop and the current function.
Last edited by DougDbug; 07-24-2003 at 07:11 PM.
The empty for loop means in effect it never ends. With for loops, you can leave out any of its parameters. If it has none, then it has no stop condition, so it just keeps going.
[edit]Curses, foiled again![/edit]
Quzah.
Hope is the first step on the road to disappointment.
for(;Originally posted by DougDbug
for(;is an infinite loop. There is no initialization, no end condition, and no increment.
This is similar to a while(1) loop, which is a more common way of doing the same thing.looks really ugly.
I'd always use while(true)...
infinite loops usually mean you could have thought through the design a little better. I don't usually like to see while(1) or for(;;). I mean you might as well just use a goto with that mentality!
Last edited by FillYourBrain; 07-25-2003 at 07:37 AM.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter