免费注册 查看新帖 |

Chinaunix

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

对C语言指针的讨论:应当如何理解、使用指针?《狂人C:程序员入门必备》有奖试读 [复制链接]

论坛徽章:
0
301 [报告]
发表于 2011-01-05 13:08 |只看该作者
本帖最后由 magicrobot1984 于 2011-01-05 13:11 编辑

偶们啥都没说。

论坛徽章:
0
302 [报告]
发表于 2011-01-05 13:10 |只看该作者
void本身难道不是一种类型?在我的概念里它是
KBTiller 发表于 2011-01-05 12:57



    void本身是一种类型,这没有错,关键是 it is an incomplete type ……

论坛徽章:
0
303 [报告]
发表于 2011-01-05 13:28 |只看该作者
void本身是一种类型,这没有错,关键是 it is an incomplete type ……
hanxuaiztt 发表于 2011-01-05 13:10



    那又如何?
    我现在不知道下面那句到底想表达什么了
   
我杂觉得有点断章取意呢,void *,只是没有指定具体类型的指针,但没说不能强转啊,但是国语的“虚无”这个含义就太多了。

论坛徽章:
0
304 [报告]
发表于 2011-01-05 13:38 |只看该作者
指针的一个重要特点是,它总是和另外一种数据类型联系在一起的。

同问:void *
magicrobot1984 发表于 2011-01-05 12:46



    既然你现在已经承认 void 是 一种数据类型
    那这个“同问”现在应该改成什么“问”呢?

论坛徽章:
0
305 [报告]
发表于 2011-01-05 13:43 |只看该作者
一点一点来吧:

[ 和前面几种整数类型不一样的是,C语言没有规定char类型究竟是 signed 还
是 unsigned ...
magicrobot1984 发表于 2011-01-05 12:36



    在C标准关于Types的说明有这样两段:
4 There are five standard signed integer types, designated as signed char, short
int, int, long int, and long long int. (These and other types may be
designated in several additional ways, as described in 6.7.2.) There may also be
implementation-defined extended signed integer types.2 The standard and extended
signed integer types are collectively called signed integer types.29)

6 For each of the signed integer types, there is a corresponding (but different) unsigned
integer type (designated with the keyword unsigned) that uses the same amount of
storage (including sign information) and has the same alignment requirements. The type
_Bool and the unsigned integer types that correspond to the standard signed integer
types are the standard unsigned integer types. The unsigned integer types that
correspond to the extended signed integer types are the extended unsigned integer types.
The standard and extended unsigned integer types are collectively called unsigned integer
types.30)

相关脚注如下
2 Implementation-defined keywords shall have the form of an identifier reserved for any use as
described in 7.1.3.
29) Therefore, any statement in this Standard about signed integer types also applies to the extended
signed integer types.
30) Therefore, any statement in this Standard about unsigned integer types also applies to the extended
unsigned integer types.

估计这是他的依据之一

论坛徽章:
0
306 [报告]
发表于 2011-01-05 13:45 |只看该作者
一点一点来吧:

[ 和前面几种整数类型不一样的是,C语言没有规定char类型究竟是 signed 还
是 unsigned ...
magicrobot1984 发表于 2011-01-05 12:36


请参见
    http://bbs.chinaunix.net/thread-1834841-2-3.html

论坛徽章:
0
307 [报告]
发表于 2011-01-05 13:46 |只看该作者
回复 305# hanxuaiztt


    这个问题前面有所讨论,请参见306楼的链接

论坛徽章:
0
308 [报告]
发表于 2011-01-05 13:48 |只看该作者
请参见
KBTiller 发表于 2011-01-05 13:45



    这个是依据?

论坛徽章:
0
309 [报告]
发表于 2011-01-05 13:50 |只看该作者
楼主既然认同“地址不是指针,指针也不能完全说是地址”,那为什么又刻意将文中的地址用指针去替代。
magicrobot1984 发表于 2011-01-05 12:51

抱歉。真的没懂您的意思

另外,楼主既然认为C里面没有地址的概念,那为什么指针一节开篇就讲地址?
magicrobot1984 发表于 2011-01-05 12:51

因为指针与地址有关啊

论坛徽章:
0
310 [报告]
发表于 2011-01-05 13:51 |只看该作者
抱歉。真的没懂您的意思


因为指针与地址有关啊
KBTiller 发表于 2011-01-05 13:50



    那为什么说C里面没有地址呢????????
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP