Why is this an issue?
Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.
Noncompliant code example
void foo()
{
int x;
if (x == 42)
/* Noncompliant - the following nested block is empty */
{
}
else
{
printf("x != 42");
}
}
void bar()
/* Compliant - functions are not nested blocks */
{
}
Compliant solution
void foo()
{
int x;
if (x != 42)
/* Compliant */
{
printf("x != 42");
}
}
/* ... */
Exceptions
When a block contains a comment, this block is not considered to be empty.