免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: send_linux
打印 上一主题 下一主题

[C] 去伪存真——品悟C的优雅与严谨(获奖名单已公布-2012-10-30) [复制链接]

论坛徽章:
0
1 [报告]
发表于 2012-10-06 17:34 |显示全部楼层
回复 1# send_linux


提几个臭屁建议:
1. 应该在前沿里说明阅读适合本书的对象。
   我很怀疑, 这本书对一个真正在编码的程序员有多大帮助?
2. 感觉样式设计不简洁, 看着不是很舒服(居然还有难易度, 学习时间, 这是24小时精通c语言吗)。
3. 代码排版没法看。
   比如缩进, 2个字节! 真想说, 讲了500页, 都不如教会代码缩进用8个字节重要!
   代码前面可以用行号, 讲解就不用再重复代码了, 这样能薄点吧。
4. 建议做个投票, 看看读过本书的人觉得有帮组的有多少。

论坛徽章:
0
2 [报告]
发表于 2012-10-09 10:17 |显示全部楼层
回复 291# sacry


    为了代码的阅读性。

    而且8个字节, 两层缩进就满行。 如果再所就要这行, 强制你简化代码, 减少嵌套。

论坛徽章:
0
3 [报告]
发表于 2012-10-09 12:32 |显示全部楼层
回复 293# sacry


    这个应该是个人风格的问题,没有哪个更好。 要是非得要什么说服力,linux内核编程风格明确指定了8字符缩进, 也说明了原因。

Chapter 1: Indentation
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.


那句过分的话,是因为2个字符缩进代码, 拿给一个陌生人看, 人家都不带理你的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP