4 ms·
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 f
by usefulcat 13y ago
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.
- byuu 13y agoThat 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.
- brianberns 13y agoAdding semantics to white space would be a huge change to the design of C (and most other languages).