[Issue 4375] Require explicit braces when 'else' is ambiguous

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 20 18:27:09 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4375



--- Comment #5 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-09-20 18:26:31 PDT ---
"The dangling else problem" is essentially the official name of the problem of
knowing which if to put the last else with if you have a series of if
statements with an else statement at the end and no braces to indicate where it
should go. The canonical way to solve it is to put the else with the last if.
It's a classic problem in programming language grammars.

Of course, the problem here is that the spacing that the programmer used seems
to indicate that he did not intend the else to go with the last if, but the
grammar is quite unambiguous on the matter. Still, it is likely an error on the
programmer's part.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list