M
Marcel Müller
Hi,
I recently had a bug where I accidentally wrote
if (condition); // <--
{ // code block
}
I did not even get a compiler warning about that (gcc 3.3.5). But the
question is, why this should be allowed at all. It makes no sense as it
will always be equivalent to
condition;
including side effects - in contrast to
while (condition);
which is obviously meaningful. However, I would prefer
while (condition) {}
for clearness.
Marcel
I recently had a bug where I accidentally wrote
if (condition); // <--
{ // code block
}
I did not even get a compiler warning about that (gcc 3.3.5). But the
question is, why this should be allowed at all. It makes no sense as it
will always be equivalent to
condition;
including side effects - in contrast to
while (condition);
which is obviously meaningful. However, I would prefer
while (condition) {}
for clearness.
Marcel