How to elimenate alignment for data structure? _C/C++_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > C/C++ > How to elimenate alignment for data structure?

How to elimenate alignment for data structure?

 2012/3/28 17:32:40  wanhuir  程序员俱乐部  我要评论(0)
  • 摘要:Justbyadding#pragmapack(push,1)and#pragmapack(pop)tosurrandthedatastructure,andcompilerwillstop.Forexample,#pragmapack(push,1)structcompoundKey{uint32_tkey1;charkey2;}#pragmapack(pop)玩会儿游戏网http://www.wanhuir.com
  • 标签:for

Just by adding #pragma pack(push,1) and #pragma pack(pop)
to surrand the data structure, and compiler will stop.

For example,

#pragma pack(push,1)
struct compoundKey{
uint32_t key1;
char????? key2;
}
#pragma pack(pop)


玩会儿游戏网 http://www.wanhuir.com

?

发表评论
用户名: 匿名