October 29, 2001 braces and try blocks | ||||
---|---|---|---|---|
| ||||
There was a discussion concerning having braces around all blocks not long ago... now the voice from the opposite side =) I wonder why does C++ require us to put braces around the try..catch blocks? This seems just not logical, since all other constructs have single-statement form. And it's actually quite often when I write something like that: try { var = vars[name]; } catch (out_of_range) { throw syntax_error("variable '" + name + "' not found'"); } All those {}s are just waste of time and space here, IMHO. I think that in D it would be better not to force these... what do you think? |
November 01, 2001 Re: braces and try blocks | ||||
---|---|---|---|---|
| ||||
Posted in reply to EvilOne | I think C++ isn't consistent <g>. "EvilOne" <evilone@omen.ru> wrote in message news:9rjqcl$f15$1@digitaldaemon.com... > There was a discussion concerning having braces around all blocks not long ago... now the voice from the opposite side =) > > I wonder why does C++ require us to put braces around the try..catch blocks? This seems just not logical, since all other constructs > have single-statement form. And it's actually quite often when I write something like that: > > try > { > var = vars[name]; > } > catch (out_of_range) > { > throw syntax_error("variable '" + name + "' not found'"); > } > > All those {}s are just waste of time and space here, IMHO. I think that in D it would be better not to force these... what do you > think? > > |
Copyright © 1999-2021 by the D Language Foundation