CodingStyle
所在版块:心情闲聊 发贴时间:2016-09-03 09:31

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
Tabs are 8 characters, and thus indentations are also 8 characters.
There are heretic movements that try to make indentations 4 (or even 2!)
characters deep, and that is akin to trying to define the value of PI to
be 3.

Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends. Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.

Now, some people will claim that having 8-character indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen. The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
your program.

In short, 8-char indents make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning.

.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

 相关帖子 我要回复↙ ↗回到正文
【青春百味】代码缩进时 程序员更喜欢空格键还是Tab键?我是空格党.... 你呢?? 功夫熊猫   (2997 bytes , 1129reads )
到minification都浮云鸟 _如花_   (0 bytes , 36reads )
tab档 saltwater   (61 bytes , 27reads )
tab设为4个空格+1,强制要求的 typhoonzj   (41 bytes , 38reads )
再加一个问题~ 羊驼君   (18 bytes , 40reads )
huan bu huan bu neng ren 功夫熊猫   (0 bytes , 30reads )
用vs2015的路过,表示大部分大码程序都会自己对齐啦 sonatam   (5 bytes , 33reads )
我觉得没有关系呀 github   (62 bytes , 47reads )
CodingStyle Spring   (954 bytes , 29reads )
Linus Torvalds 的Kernal Coding Style Sam_Fisher   (0 bytes , 61reads )
tab togaf8   (10 bytes , 37reads )
缩进 indentation 跟对齐 alignment 不是一回事~ Delacroix   (172 bytes , 47reads )
缩进是为了对齐~ 功夫熊猫   (0 bytes , 30reads )
我是用tab的 On   (33 bytes , 39reads )
tab设置为4个空格 rabbitwf   (5 bytes , 34reads )
还是插件 Tab 替换成 Space 好... 功夫熊猫   (0 bytes , 43reads )
空格党+1 羊驼君   (11 bytes , 42reads )