开发者

Why does Google use 2 spaces instead of 4/8/whatever? [closed]

开发者 https://www.devze.com 2023-01-31 03:23 出处:网络
It's difficult to tell what is being asked 开发者_开发百科here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
It's difficult to tell what is being asked 开发者_开发百科here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

Does anyone know why Google's coding standards (C++ Style Guide e.g. but I think the same applies to others as well) use 2 spaces for indentation instead of 4?


The only reason I can think of is deeply nested code: with 4 spaces and a sufficient amount of nested if, loops or whatever, the leftmost half of your monitor will be obviously blank, if you're using a low resolution.
Personally I would always prefer 4, but I can see why somebody might want less than that while writing HTML, for instance.

Personal preferences really - most editors will use 4 spaces by default.

0

精彩评论

暂无评论...
验证码 换一张
取 消