Re:Those Who Say Code Does Not Matter
by usefulcat on Wednesday April 16, 2014 @03:32PM
(#7599984)
Ah, a fair point! However, since we're talking about the hypothetical language what-C-might-have-been, I would suggest a further improvement: require braces for all conditionals /and/ require that the opening and closing braces shall not be on the same line.
[ Parent
| on HN ]
That would really start to hurt readability. There are plenty of instances where the body is very similar save for a small change, and having it lined up in a grid makes it much easier to read. As a contrived example, you can look straight down to see the action values here:
if(condition_1) { action(318); }
if(condition_2) { action(219); }
if(condition_3) { action(142); }
In my opinion, the bigger risk is having a single-statement if have its payload on the next line.
if(x.open()) x.close(); //very difficult to add another statement accidentally here
if(x.open())
x.close(); //much easier to do so here
But of course I wouldn't want to start treating whitespace as special in C.
Re:Those Who Say Code Does Not Matter
by brianberns on Wednesday April 16, 2014 @03:46PM
(#7600093)
Adding semantics to white space would be a huge change to the design of C (and most other languages).