Chinaunix首页 | 论坛 | 博客
  • 博客访问: 223052
  • 博文数量: 71
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 1025
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-25 19:00
文章分类

全部博文(71)

文章存档

2009年(2)

2008年(69)

我的朋友

分类:

2008-03-24 17:08:34



必须:

struct student{

 char a;

 char b;

 int   c;

}__attribute__ ((packed));

typedef struct student student_t;

student_t stdent_a;

才会真正的有效,如果:

typdef student{

 char a;

 char b;

 int   c;

}student_t  __attribute__ ((packed));

是没有起packed 的作用的。

note: 以上实验是在powerpc 860 cpu,gnu gcc,vxworks platform上验证。

david 20060419/shanghai/baniantech



or write as follows:

typedef struct student{
char a;
char b;
int c;
}student_t __attribute__ ((packed));


阅读(892) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~