是什么在64位计算机的指针大小在C ++? [英] What the pointer size in 64 bits computer in C++?
问题描述
我的电脑是改变从32位到64位,和我的操作系统是64位的Windows 7。我认为,在64位操作系统下指针应是64位 - 8个字节。但是,当我使用的sizeof()在C ++中拿到一分的大小,结果是4。
My computer is change from 32 bits to 64 bits, and my operating system is 64 bits Windows 7. I think the pointer in 64 bits operating system should be 64 bits -- 8 bytes. However, when I use sizeof() in C++ to get the size of a point, the result is 4.
为什么4 ??
推荐答案
您的可执行文件仍然被编译为一个32位二进制。尝试编译它作为一个64位的项目
Your executable is still being compiled as a 32-bit binary. Try compiling it as a 64-bit project.
该操作系统不产生任何影响,如果所述处理器内的32位环境仿真程序...
The operating system makes no difference to the internal size of a pointer if the processor is emulating the program within a 32-bit environment...
在VS2010中,头部到配置管理,使平台下的一个新的条目,然后选择 64
(通常这是唯一的选择有)
In VS2010, head over to the configuration manager, make a new entry under 'platform', and select x64
(usually it's the only other option there)
编辑:同时,要确保你传递一个无效*
到的sizeof()
运营商。
Also, make sure you're passing a void*
to the sizeof()
operator.
这篇关于是什么在64位计算机的指针大小在C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!