免费注册 查看新帖 |

Chinaunix

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

C深度剖析 [复制链接]

论坛徽章:
0
121 [报告]
发表于 2012-06-21 15:43 |只看该作者
回复 123# sacry


那你给个翻译??

论坛徽章:
0
122 [报告]
发表于 2012-06-21 15:43 |只看该作者
回复 124# kzl0629

你说“一个32位的signed int类型整数其值表示法范围为:- 2^31~2^31 -1”没错不算误导新手?
移码都出来了……
掌握不牢靠就认了好了,这里没谁有兴趣欺负你。
ISO C11(N1570)
6.2.6.2 Integer types
1 For unsigned integer types other than unsigned char, the bits of the object representation shall be divided into two groups: value bits and padding bits (there need not be any of the latter). If there are N value bits, each bit shall represent a different power of 2 between 1 and 2^(N − 1), so that objects of that type shall be capable of representing values from 0 to 2^(N − 1) using a pure binary representation; this shall be known as the value representation. The values of any padding bits are unspecified.53)
2 For signed integer types, the bits of the object representation shall be divided into three groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
signed char shall not have any padding bits. There shall be exactly one sign bit.
Each bit that is a value bit shall have the same value as the same bit in the object representation of the corresponding unsigned type (if there are M value bits in the signed type and N in the unsigned type, then M ≤ N). If the sign bit is zero, it shall not affect the resulting value. If the sign bit is one, the value shall be modified in one of the
following ways:
— the corresponding value with sign bit 0 is negated (sign and magnitude);
— the sign bit has the value −(2M) (two’s complement);
— the sign bit has the value −(2M − 1) (ones’ complement).
Which of these applies is implementation-defined, as is whether the value with sign bit 1 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones’ complement), is a trap representation or a normal value. In the case of sign and magnitude and ones’ complement, if this representation is a normal value it is called a negative zero.
53) Some combinations of padding bits might generate trap representations, for example, if one padding bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap representation other than as part of an exceptional condition such as an overflow, and this cannot occur with unsigned types. All other combinations of padding bits are alternative object representations of the value specified by the value bits.

论坛徽章:
11
未羊
日期:2013-12-16 12:45:4615-16赛季CBA联赛之青岛
日期:2016-04-11 19:17:4715-16赛季CBA联赛之广夏
日期:2016-04-06 16:34:012015亚冠之卡尔希纳萨夫
日期:2015-11-10 10:04:522015亚冠之大阪钢巴
日期:2015-07-30 18:29:402015亚冠之城南
日期:2015-06-15 17:56:392015亚冠之卡尔希纳萨夫
日期:2015-05-15 15:19:272015亚冠之山东鲁能
日期:2015-05-14 12:38:13金牛座
日期:2014-12-04 15:34:06子鼠
日期:2014-10-16 13:40:4715-16赛季CBA联赛之八一
日期:2016-07-22 09:41:40
123 [报告]
发表于 2012-06-21 15:44 |只看该作者
nilgod 发表于 2012-06-21 15:43
回复 125# zylthinking


承蒙他看得起, 诚惶诚恐, 不胜感激涕零之至

论坛徽章:
0
124 [报告]
发表于 2012-06-21 15:45 |只看该作者

论坛徽章:
0
125 [报告]
发表于 2012-06-21 15:45 |只看该作者
回复 125# zylthinking

无bug要看你怎么约定。

论坛徽章:
11
未羊
日期:2013-12-16 12:45:4615-16赛季CBA联赛之青岛
日期:2016-04-11 19:17:4715-16赛季CBA联赛之广夏
日期:2016-04-06 16:34:012015亚冠之卡尔希纳萨夫
日期:2015-11-10 10:04:522015亚冠之大阪钢巴
日期:2015-07-30 18:29:402015亚冠之城南
日期:2015-06-15 17:56:392015亚冠之卡尔希纳萨夫
日期:2015-05-15 15:19:272015亚冠之山东鲁能
日期:2015-05-14 12:38:13金牛座
日期:2014-12-04 15:34:06子鼠
日期:2014-10-16 13:40:4715-16赛季CBA联赛之八一
日期:2016-07-22 09:41:40
126 [报告]
发表于 2012-06-21 15:50 |只看该作者
幻の上帝 发表于 2012-06-21 15:45
回复 125# zylthinking

无bug要看你怎么约定。


我就想看看你的代码到底是啥样的, 做出了什么样的东西; 和你研究C标准没关系;
要说有关系也可以说对, 我就想看看懂C标准能做出什么样的东西能让我这样的大老粗啥都不懂的泥腿子庄稼汉高山仰止, 叹为观止

论坛徽章:
0
127 [报告]
发表于 2012-06-21 15:54 |只看该作者
回复 127# kzl0629

难道断句不是这么断的么??
The extent , to which such suggestions are effective,  is implementation-defined.

   

论坛徽章:
0
128 [报告]
发表于 2012-06-21 15:55 |只看该作者
回复 129# 幻の上帝


    2 For signed integer types, the bits of the object representation shall be divided into three groups: value bits, padding bits, and the sign bit. There need not be any padding bits;

paading虽然定义了,但是不需要

论坛徽章:
0
129 [报告]
发表于 2012-06-21 15:55 |只看该作者
回复 135# sacry


    The extent to  , which such suggestions are effective,  is implementation-defined.

论坛徽章:
0
130 [报告]
发表于 2012-06-21 15:59 |只看该作者
回复 134# zylthinking


    我也是个泥腿子,用的都是非标准的编译器,无奈自己不是做编译器的啊~~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP