I've seen this on occasion in books I've read. But I've found no explanation.
for (;;)
{
// Do some stuff.
}
Is it kind of like "while(true)"? Basically an endless loop for polling or something? Basically something you'd do until you intentionally break the loop?
Is it kind of like "while(true)"?
Yes. It loops forever.
Also note the comment by Andrew Coleson:
Languages like C don't have built-in boolean primitives, so some people prefer for(;;) over while(1)
Yes.
In a for if nothing is provided:
It is equivalent to while(true).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With