X64与X86各个类型的长度
来源:互联网 发布:在淘宝上搜春药怎么搜 编辑:程序博客网 时间:2024/06/07 03:51
struct T {
char a;
int b;
char c;
};
struct E {
};
// Linux 平台 (基于 CentOS6.5)
printf("%d\n", sizeof(struct T)); //x86 12 x64 12
printf("%d\n", sizeof(struct E)); //x86 0 x64 0
printf("%d\n", sizeof(char)); //x86 1 x64 1
printf("%d\n", sizeof(short int)); //x86 2 x64 2
printf("%d\n", sizeof(int)); //x86 4 x64 4
printf("%d\n", sizeof(long)); //x86 4 x64 8
printf("%d\n", sizeof(long long)); //x86 8 x64 8
printf("%d\n", sizeof(float)); //x86 4 x64 4
printf("%d\n", sizeof(double)); //x86 8 x64 8
printf("%d\n", sizeof(long double)); //x86 12 x64 16
printf("%d\n", sizeof(void)); //x86 1 x64 1
printf("%d\n", sizeof(void*)); //x86 4 x64 8
printf("%d\n", sizeof(size_t)); //x86 4 x64 8
-------------------------------------------------------------------------------------------------------
// Windows 平台 (基于 VS2013 Win10)
printf("%d\n", sizeof(struct T)); //x86 12 x64 12
printf("%d\n", sizeof(struct E)); //x86 1 x64 1
printf("%d\n", sizeof(short int)); //x86 2 x64 2
printf("%d\n", sizeof(int)); //x86 4 x64 4
printf("%d\n", sizeof(long)); //x86 4 x64 4
printf("%d\n", sizeof(long long)); //x86 8 x64 8
printf("%d\n", sizeof(float)); //x86 4 x64 4
printf("%d\n", sizeof(double)); //x86 8 x64 8
printf("%d\n", sizeof(long double)); //x86 8 x64 8
//printf("%d\n", sizeof(void)); //error C2070
printf("%d\n", sizeof(void*)); //x86 4 x64 8
printf("%d\n", sizeof(size_t)); //x86 4 x64 8
-------------------------------------------------------------------------------------------------------
类型 Linux x86 Linux x64 WinX86 WinX64
struct T
12
12
12
12
struct E
0
0
1
1
char
1
1
1
1
short int
2
2
2
2
int
4
4
4
4
long
4
8
4
4
long long
8
8
8
8
float
4
4
4
4
double
8
8
8
8
long double
12
16
8
8
void
1
1
-
-
void*
4
8
4
8
size_t
4
8
4
8
----------------------------------------------------------------------------------------------------------
类型
format
char
%c
signed char
%c (or %hhi for numerical output)
unsigned char
%c (or %hhu for numerical output)
short
short int
signed short
signed short int
%hi
unsigned short
unsigned short int
%hu
int
signed
signed int
%i or %d
unsigned
unsigned int
%u
long
long int
signed long
signed long int
%li or %ld
unsigned long
unsigned long int
%lu
long long
long long int
signed long long
signed long long int
%lli or %lld
unsigned long long
unsigned long long int
%llu
float
%f (promoted automatically to double for printf())
double
%f (%F)(%lf (%lF) for scanf())
%g %G
%e %E
long double
%Lf %LF
%Lg %LG
%Le %LE
- X64与X86各个类型的长度
- x86/x64 指令长度的解码
- C语言各类型在x86与x64环境下的长度
- 坑爹的“模块计算机类型“x64”与目标计算机类型“X86”冲突”
- 关于fatal error LNK1112: 模块计算机类型“x64”与目标计算机类型“X86”冲突的解决办法
- 模块计算机类型“X64”与目标计算机类型“X86”冲突问题的几点补充
- 「模块计算机类型“X86”与目标计算机类型“x64”冲突」问题的解决办法:
- 解决“计算机类型X86与目标计算机类型X64冲突”的问题
- 模块计算机类型“X86”与目标计算机类型“x64”冲突
- 模块计算机类型“x64”与目标计算机类型“X86”冲突
- “模块计算机类型“x86”与目标计算机类型“X64”冲突”
- 模块计算机类型“X64”与目标计算机类型“x86”冲突”
- 模块计算机类型x64与目标计算机类型X86冲突
- 模块计算机类型“X86”与目标计算机类型“x64”冲突
- X86操作系统与X64操作系统的区别
- X86与X64
- fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突——我的解决方案
- fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突——我的解决方案
- [jQuery] 添加读取csv文件的扩展
- windows系统 安装MongoDB 32位
- java设计模式之代理模式
- 《Thing in java》上塑造型的笔记
- Python 重定向 响应头
- X64与X86各个类型的长度
- SpringBoot 项目如何在tomcat容器中运行
- tar命令的详细解释
- 微信红包订单存储架构变迁的最佳实践
- Spread Studio跨平台表格控件集发布V11版本,速度更快、内存更省
- Kotlin 开发
- YYCache学习
- 第14周项目1(6)- 验证算法 堆排序
- Git分支管理规范