Found in torvalds/linux-2.6.git -> kernel/mutex.c line 171
I have tried to find it on Google and such to no avail.
What does for (;;)
instruct?
Found in torvalds/linux-2.6.git -> kernel/mutex.c line 171
I have tried to find it on Google and such to no avail.
What does for (;;)
instruct?
It literally means "do nothing, until nothing happens and at each step, do nothing to prepare for the next". Basically, it's an infinite loop that you'll have to break somehow from within using a
break
,return
orgoto
statement.I means:
Warning: Using this in your code is highly discouraged.
is an infinite loop just like
while(1)
. Here no condition is given that will terminate the loop. If you are not breaking it usingbreak
statement this loop will never come to an end.It's equivalent to
while( true )
Edit: Since there's been some debate sparked by my answer (good debate, mind you) it should be clarified that this is not entirely accurate for C programs not written to C99 and beyond wherein stdbool.h has set the value of true = 1.
It is an infinite loop which has no initial condition, no increment condition and no end condition. So it will iterate forever equivalent to while(1).
it is an infinite for loop.