Dangling if
Andrej Mitrovic
andrej.mitrovich at gmail.com
Thu Sep 27 19:12:46 PDT 2012
On 9/28/12, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> That would make the language whitespace-sensitive, which I would consider a
> major no-no.
I don't know of any use-case where you actually want to use such an if
statement. Would you ever allow this to pass a human code-review?:
if (bVal)
doSomething();
Btw this could also have been generated by some template mixin, don't
you want to be warned in such a case? I sure do.
On 9/28/12, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> I really don't think that trying to warn people about doing stupid things
> with formatting (be it on purpose or by accident) is something worth attempting.
But it can be a source of bugs.
This is a very specific situation that could be handled unless it is
too complex to mess with the lexer. If there's an if statement which
isn't followed by a block but is followed by a blank line emit a
warning. Sounds simple enough to me.
More information about the Digitalmars-d
mailing list