Dangling if

Jonathan M Davis jmdavisProg at gmx.com
Sun Sep 30 02:56:19 PDT 2012


On Sunday, September 30, 2012 11:42:40 monarch_dodra wrote:
> Personally, EVEN when I'm doing a 1 line if, I *still* wrap it in
> a block. EG:

To each their own. Personally, it drives me nuts to have braces when they're 
completely unnecessary. I use braces only when the condition or body is more 
than one line long.

And I don't think that I've _ever_ run into a dangling else problem (if 
nothing else, because I'd always use braces in cases where it could happen). 
But everyone seems to run into different problems.

> Further more, thanks to D's ban on "if();", you can litterally
> never fail with this format.

That is definitely one of D's better design choices.

- Jonathan M Davis


More information about the Digitalmars-d mailing list