免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3660 | 回复: 3
打印 上一主题 下一主题

Mac的同学,编译运行一下这个代码把结果贴出来吧(应该都是64位的吧)谢谢 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-07 13:20 |只看该作者 |倒序浏览
#include <iostream>

using namespace std;

int main(int argv, char ** argc)
{
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "char " << sizeof(char) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "short "<< sizeof(short) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "int " << sizeof(int) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "long " << sizeof(long) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "long long " << sizeof(long long) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "float " << sizeof(float) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "double " << sizeof(double) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "long double " << sizeof(long double) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;cout<< "pointer " << sizeof(void*) << endl;
&nbsp;&nbsp;&nbsp;&nbsp;return 0;
}

论坛徽章:
0
2 [报告]
发表于 2008-06-07 18:39 |只看该作者
char 1
short 2
int 4
long 4
long long 8
float 4
double 8
long double 16
pointer 4

yfmacpro:tmp yaofei$ gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

论坛徽章:
0
3 [报告]
发表于 2008-06-07 18:41 |只看该作者
yfmacpro:tmp yaofei$ g++ -o a -m64 a.cc
yfmacpro:tmp yaofei$ ./a
char 1
short 2
int 4
long 8
long long 8
float 4
double 8
long double 16
pointer 8

论坛徽章:
0
4 [报告]
发表于 2008-06-08 12:34 |只看该作者
谢谢YF
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP