Optional braces

Walter Bright newshound2 at digitalmars.com
Tue Aug 23 13:46:49 PDT 2011


On 8/19/2011 8:12 AM, Andrei Alexandrescu wrote:
> One thing I'd subjectively like is to require braces on both branches of if/else
> if at least one has braces.

It's rather simple to just disallow the form:

     if (a) if (b) statement
            ^ error: use if(a&&b) or if(a){if(b)statement}

and not even pay attention if there's a dangling else or not. I've always viewed 
things like:

     if (a)
       if (b)
          ...
     ...

with suspicion, anyway, dangling else or not.


More information about the Digitalmars-d mailing list