What is the \"hanging else\" problem? (Is that the right name?)
Following a C++ coding standard (forgot which one) I always use brackets (block) with control structu
Which if does the else belong to?
if
else
if (a < b) if (c < d) a = b + d; else b = a + c;
(Obviously you should ignore the indentation.)
That's the "hanging else problem".
C/C++ gets rid of the ambiguity by having a rule that says you can't have an-if-without-an-else as the if-body of an-if-with-an-else.