2009年8月25日

C的struct内存对齐的问题(二)

摘要: #include <stdio.h>#include <iostream.h>int main(void){ typedef struct{ unsigned short a:8; unsigned short b:9; unsigned short c:10; }T_struct1; typedef struct{ unsigned short a:2; unsign... 阅读全文

posted @ 2009-08-25 10:53 vincenzo.lai 阅读(385) 评论(0) 推荐(0)

C的struct内存对齐的问题

摘要: 采用VC6的的编译器对于struct:struct ST_DAT1 { char cDatA; int nDatC; char cDatB; } stDblChr;struct ST_DAT2 { char cDatA; char cDatB; int nDatC; } stDblChr;很显然,编译器在编译的时候,要做内存对齐的调整。由于两个struct中最长的变量都是int,占... 阅读全文

posted @ 2009-08-25 10:44 vincenzo.lai 阅读(1336) 评论(0) 推荐(0)

C在return之后执行函数

摘要: 通过atexit调用函数,可以再main函数return之后再执行刚刚被调用的函数。msdn解释是:The atexit function is passed the address of a function (func) to be called when the program terminates normally. Successive calls to atexit create a ... 阅读全文

posted @ 2009-08-25 10:09 vincenzo.lai 阅读(946) 评论(0) 推荐(0)

导航