11月 28

程序代码中的缩进与大括号风格

  • K&R style

Named after Kernighan & Ritchie, because the examples in K&R are formatted this way. Also called `kernel style’ because the Unix kernel is written in it, and the `One True Brace Style’ (abbrev. 1TBS) by its partisans. In C code, the body is typically indented by eight spaces (or one tab) per level, as shown here. Four spaces are occasionally seen in C, but in C++ and Java four tends to be the rule
rather than the exception.……【阅读全文】