In The Linux Programming Interface, in some parts (for example section 26.3.1) the following code is written
while (waitpid(-1, NULL, WNOHANG) > 0)
continue;
What is the difference between the above code and the following?
while (waitpid(-1, NULL, WNOHANG) > 0);
I think the second is better, but the mentioned book is a reference book so I have this question.
I looked in two books (The Linux Programming inTerface, Advanced programming in UNIX environment) and also I searched google.
>Solution :
The continue in your first example exists to make it a more readable loop and serves no functional purpose. The ; alone can be easily missed. Likewise for {}