免费注册 查看新帖 |

Chinaunix

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

[C] 有多少C程序员认为这是错误的写法 [复制链接]

论坛徽章:
0
101 [报告]
发表于 2012-05-12 21:10 |只看该作者
回复 99# OwnWaterloo


就是这个。

论坛徽章:
0
102 [报告]
发表于 2012-05-12 21:10 |只看该作者
回复 99# OwnWaterloo


    还有,提醒一句,我不是你,我不需要记,你才需要,这是你的长处。

论坛徽章:
0
103 [报告]
发表于 2012-05-12 21:11 |只看该作者
回复 100# OwnWaterloo


    什么叫又想破关。难道你这种鸡肠小肚的人以为我闭关了?

论坛徽章:
2
青铜圣斗士
日期:2015-11-26 06:15:59数据库技术版块每日发帖之星
日期:2016-07-24 06:20:00
104 [报告]
发表于 2012-05-12 21:22 |只看该作者
walleeee 发表于 2012-05-12 20:06
回复 79# 三月廿七

智慧

只是你也不该说别人脑残,比如以前就有

p[x]
*(p+x)

这2个性能的比较,第二个要稍微快一些,这个在深入理解计算机系统里面有提到,但是对于现在的编译器优化和体系结构而言,这已经过时了。

OwnWaterloo 发表于 2012-05-12 21:08
回复 95# walleeee

p[x]与*(p+x)?还性能比较? 它们是等价的,知道吗?
少年, 将p[x] vs *(p+x) 与 ++i,p[ i ] vs ++p,*p 记混了。


walleeee 发表于 2012-05-12 21:10
回复 99# OwnWaterloo

    还有,提醒一句,我不是你,我不需要记,你才需要,这是你的长处。


究竟出于什么样的心理?非补上这一句才显得你胜利了?

论坛徽章:
2
青铜圣斗士
日期:2015-11-26 06:15:59数据库技术版块每日发帖之星
日期:2016-07-24 06:20:00
105 [报告]
发表于 2012-05-12 21:24 |只看该作者
walleeee 发表于 2012-05-12 21:11
回复 100# OwnWaterloo

    什么叫又想破关。难道你这种鸡肠小肚的人以为我闭关了?


walleeee1 发表于 2012-04-28 18:12
rt,兄台怎么把我禁止发言了。。。我刚才开始收到一个警告,然后过了几分钟,我又联系收到2个,然后就不能发帖了。
我连个解释机会都没有了,所以注册这个id来声明一下。

这是什么情况?

是不是ow那个死人的贴?是ow先开始攻击我的,请send兄台明鉴啊!!!!!!!


id: walleeee

这就叫小黑屋。才半个月而已,忘了?

论坛徽章:
0
106 [报告]
发表于 2012-05-12 21:26 |只看该作者
回复 104# OwnWaterloo


没什么心理,只是你说了我记混了,所以我给你解释一下而已。你看不懂我的意思?


另外,前面你说你对emacs挺感兴趣,我这里有一个不错的emacs电子材料,发你分享一下。
看不上就当没看到好了,别放屁出来。

ProgrammingWithGNUEmacsLisp.pdf

169.74 KB, 下载次数: 6

elispintro.pdf

1.83 MB, 下载次数: 9

论坛徽章:
0
107 [报告]
发表于 2012-05-12 21:27 |只看该作者
回复 105# OwnWaterloo


    我就关了半天就被放出来了。对于你这种鸡肠小肚的小人,我将来肯定会小心的,你放心。我不会再中你狗计了

论坛徽章:
0
108 [报告]
发表于 2012-05-13 05:39 |只看该作者
回复 76# OwnWaterloo
对。很多时候不只是ISO C的问题了。但既然混不进ISO JTC1/SC22/WG14内部,那只能盯着既定事项干瞪眼。
但上层解决不了的问题,实际解决的话,也不是非要到底层解决。因为解决了,你也很难评估可行性。回避通常更节约时间。
就LZ的例子,float score[20]就会少根筋么。


论坛徽章:
0
109 [报告]
发表于 2012-05-13 05:41 |只看该作者
回复 77# OwnWaterloo


其实就是不爽ISO C嘛。要是说的有你这么清楚就好了。但实际上没有。那我就得想了,为什么?是标准委员会没考虑到,还是另有所图?

论坛徽章:
0
110 [报告]
发表于 2012-05-13 06:04 |只看该作者
回复 78# OwnWaterloo


……ISO C约定的比你的更复杂些:
ISO C11 N1570 6.5
6 The effective type of an object for an access to its stored value is the declared type of the object, if any.87) If a value is stored into an object having no declared type through an lvalue having a type that is not a character type, then the type of the lvalue becomes the effective type of the object for that access and for subsequent accesses that do not modify the stored value. If a value is copied into an object having no declared type using memcpy or memmove, or is copied as an array of character type, then the effective type of the modified object for that access and for subsequent accesses that do not modify the value is the effective type of the object from which the value is copied, if it has one. For all other accesses to an object having no declared type, the effective type of the object is simply the type of the lvalue used for the access.
7 An object shall have its stored value accessed only by an lvalue expression that has one of the following types:8
— a type compatible with the effective type of the object,
— a qualified version of a type compatible with the effective type of the object,
— a type that is the signed or unsigned type corresponding to the effective type of the object,
— a type that is the signed or unsigned type corresponding to a qualified version of the effective type of the object,
— an aggregate or union type that includes one of the aforementioned types among its
members (including, recursively, a member of a subaggregate or contained union), or
— a character type.
无论如何,character type是特殊的。
题外话,ISO C++把char/unsigned char和signed char区别对待了,前者受到限制更少。似乎CWG有讨论过这个问题,但后来不了了之(奇怪,我翻最近的列表又找不到了)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP