指针的大小问题
来源:互联网 发布:r语言数据集 编辑:程序博客网 时间:2024/06/04 08:28
问题来源:点击打开链接
Also we have learned that on different systems the size of a pointercan vary. As it turns out it is also possible that the size ofa pointer can vary depending on the data type of the object towhich it points. Thus, as with integers where you can run intotrouble attempting to assign a long integer to a variable of typeshort integer, you can run into trouble attempting to assign thevalues of pointers of various types to pointer variables of othertypes.
意思是说:一个指针的大小,这里的大小是指 指针 的长度, 也就是 sizeof(Pointer)的值,根据指针指向的数据类型的不同而不同。
好像99.9%的教材讲的都不一样哦
stackoverflow: 点击打开链接
The C standard allows pointers to different types to have different sizes, e.g.sizeof(char*) != sizeof(int*)
is permitted. It does, however, require that if a pointer is converted to avoid*
and then back to its original type, it must compare as equal to its original value. Therefore, it follows logically thatsizeof(void*) >= sizeof(T*)
for all types T
, correct?
On most common platforms in use today (x86, PPC, ARM, and 64-bit variants, etc.), the size of all pointers equals the native register size (4 or 8 bytes), regardless of the pointed-to type. Are there any esoteric or embedded platforms where pointers to different types might have different sizes? I'm specifically asking about data pointers, although I'd also be interested to know if there are platforms wherefunction pointers have unusual sizes.
I'm definitely not asking about C++'s pointer-to-members and pointer-to-member-functions. Those take on unusual sizes on common platforms, and can even vary within one platform, depending on the properties of the pointer-to class (non-polymorphic, single inheritance, multiple inheritance, virtual inheritance, or incomplete type).
- 指针的大小问题
- 指针的大小--sizeof问题
- 指针的大小--sizeof问题
- 指针的大小--sizeof问题
- 指针的大小--sizeof问题
- 关于c++指针大小的问题
- 【转】指针的大小--sizeof问题
- C语言的指针大小问题
- 关于指针变量所占内存空间大小的问题
- 指针的大小--sizeof问题和sizeof使用规则
- 指针的大小
- 指针的大小
- 指针的大小
- 指针的大小
- 指针的大小
- 指针的大小
- 指针的大小
- 指针的大小legend
- isapi rewrite full 破解版
- flex开发新手应注意的地方
- Windows Internal Database 是什么?
- 获取oracle 表字段,表名,以及主键之类等等的信息。
- Android程序完全退出的三种方法
- 指针的大小问题
- 在 struts2中从jsp页面传值到action中
- PB6.5连接SQLServer2005时的问题
- 《把时间当作朋友》读书笔记
- win7系统不兼容软件问题的解决办法
- 书目摘记
- 使用单词树进行词频统计算法
- wsus没法上报的处理办法
- 动态生成二维数组