怪异的一个问题,完全不在知识范围内。今天弄DLL的,求解。
代码:
输出居然是:
sizeof(unsigned char)=1,sizeof(int)=4,sizeof(double)=8
sizeof(tg1)=8,sizeof(tg2)=16,sizeof(tg3)=16,sizeof(tg4)=16,sizeof(tg5)=16,sizeof(tg6)=24,sizeof(tg7)=24,sizeof(tg8)=32,sizeof(tg9)=56
完全无法理解,不在只是范围内,能不能有哪位大哥帮忙解释一下。
#include "stdafx.h"
typedef struct tag_tg1
{
//unsigned char f1;
//unsigned char f2;
//unsigned char f3;
//unsigned char f4;
//unsigned char f5;
//int f6;
double f7;
}tg1;
typedef struct tag_tg2
{
//unsigned char f1;
//unsigned char f2;
//unsigned char f3;
//unsigned char f4;
//unsigned char f5;
int f6;
double f7;
}tg2;
typedef struct tag_tg3
{
unsigned char f1;
//unsigned char f2;
//unsigned char f3;
//unsigned char f4;
//unsigned char f5;
int f6;
double f7;
}tg3;
typedef struct tag_tg4
{
unsigned char f1;
unsigned char f2;
//unsigned char f3;
//unsigned char f4;
unsigned char f5;
int f6;
double f7;
}tg4;
typedef struct tag_tg5
{
unsigned char f1;
unsigned char f2;
unsigned char f3;
//unsigned char f4;
unsigned char f5;
int f6;
double f7;
}tg5;
typedef struct tag_tg6
{
unsigned char f1;
unsigned char f2;
unsigned char f3;
unsigned char f4;
unsigned char f5;
int f6;
double f7;
}tg6;
typedef struct tag_tg7
{
unsigned char f1;
unsigned char f2;
unsigned char f3;
unsigned char f4;
unsigned char f5;
int f6;
int f7;
double f8;
}tg7;
typedef struct tag_tg8
{
unsigned char f1;
unsigned char f2;
unsigned char f3;
unsigned char f4;
unsigned char f5;
int f6;
int f7;
double f8;
double f9;
}tg8;
typedef struct tag_tg9
{
unsigned char f1;
unsigned char f2;
unsigned char f3;
unsigned char f4;
unsigned char f5;
int f6;
int f7;
double f8;
double f9;
char f10[20];
}tg9;
int main(int argc, char* argv[])
{
printf("sizeof(unsigned char)=%d,sizeof(int)=%d,sizeof(double)=%d\n",sizeof(unsigned char),sizeof(int),sizeof(double));
printf("sizeof(tg1)=%d,sizeof(tg2)=%d,sizeof(tg3)=%d,sizeof(tg4)=%d,sizeof(tg5)=%d,sizeof(tg6)=%d,sizeof(tg7)=%d,sizeof(tg8)=%d,sizeof(tg9)=%d\n",sizeof(tg1),sizeof(tg2),sizeof(tg3),sizeof(tg4),sizeof(tg5),sizeof(tg6),sizeof(tg7),sizeof(tg8),sizeof(tg9));
return 0;
}
输出居然是:
sizeof(unsigned char)=1,sizeof(int)=4,sizeof(double)=8
sizeof(tg1)=8,sizeof(tg2)=16,sizeof(tg3)=16,sizeof(tg4)=16,sizeof(tg5)=16,sizeof(tg6)=24,sizeof(tg7)=24,sizeof(tg8)=32,sizeof(tg9)=56
完全无法理解,不在只是范围内,能不能有哪位大哥帮忙解释一下。
...全文
相关推荐
别动我的坏电脑,吓人专用
别动我的坏电脑,吓人专用,呵呵,可以恶作剧,不要干坏事啊
多功能WebCam C#库
易于使用的C#WebCam库不受怪异的DLL引用或PInvoke调用的困扰
微软订阅邮件
从网上收集的一些朋友的htm格式的文档。有我整理成pdf格式,方便阅读。里面有大量代码和说名。有许多编程中常用到的说明。值得下载
快手 AAuto Quicker v28.21官方版
为您提供快手 AAuto Quicker下载,快手AAuto编程语言更名为 aardio,可以直接内c和js代码的胶水语言,代码简洁运行效率高,各种自动化操作软件开发的首选 。完美支持静态类型、动态类型,完美支持COM、DLL API、REMOTE EXE CALL API。 主要面向小型轻量快速开发应用,专用于模拟自动化、web自动化、自动化测试、机器人程序开发。 AAuto广泛吸收各种语言中的优秀语法特性,抛弃另类怪异的设计风格,广泛兼
快手 AAuto Quicker v29.9.2官方版
为您提供快手 AAuto Quicker下载,快手AAuto编程语言更名为 aardio,可以直接内c和js代码的胶水语言,代码简洁运行效率高,各种自动化操作软件开发的首选 。完美支持静态类型、动态类型,完美支持COM、DLL API、REMOTE EXE CALL API。 主要面向小型轻量快速开发应用,专用于模拟自动化、web自动化、自动化测试、机器人程序开发。 AAuto广泛吸收各种语言中的优秀语法特性,抛弃另类怪异的设计风格,广泛兼


