The loop is as follows:
do;
while(1);
Why the above loop is not giving a syntax error?
That code looks like it was written to obfuscate its meaning but if we look at the draft C99 standard section 6.8.5
Iteration statements, the grammar for do while is:
do statement while ( expression ) ;
and statement can be an expression statement which in turn can be a null statement which is what ;
is. So it is the same as:
do
;
while(1);
we can see from section 6.8.3
Expression and null statements paragraph 3 says:
A null statement (consisting of just a semicolon) performs no operations.
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