|
|
|
|
|
by xamuel
4037 days ago
|
|
Indentation to identify blocks can break down in things like switch statements: switch( c ) { case 'A':
simple_stuff();
break;
case 'B': {
int temporary_variable = 0;
complex_stuff( temporary_variable );
}
To me, the advantage of braces on newlines is it makes it extremely easy to tell where blocks start and end---whether you're using your favorite IDE, or reading the code on a blog, or reading the code with "cat". I actually think it's a case where Python has the design advantage on C (since if you do braces-on-newline consistently enough, you end up duplicating python but with superfluous braces added in). |
|
It's all backward. The IDE should SHOW you the blocks somehow (background tone changes etc), and let you edit the blocking explicitely. If they look wrong, you select and hit a key. Now you're in agreement with the compiler.