摘要: https://www.geeksforgeeks.org/structure-member-alignment-padding-and-data-packing/ https://stackoverflow.com/questions/3903164/why-misaligned-address- 阅读全文
posted @ 2022-09-14 16:40 秋来叶黄 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 一 union MyUnion { int a; INT64 b; char c[9]; }; MyUnion大小为16,最大变量为c,占用9个,填充7个 二 union MyUnion { int a; int b; char c[9]; }; union MyUnion1 { INT64 a; 阅读全文
posted @ 2022-09-14 11:03 秋来叶黄 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 一 struct MyStruct { short a[3]; }; 结构体大小为6,每个short是2个字节,3个正好是6 二 struct MyStruct { char a[3]; }; 结构体大小为3,每个char是1个字节,3个正好是3 三 struct MyStruct { short 阅读全文
posted @ 2022-09-14 10:46 秋来叶黄 阅读(127) 评论(0) 推荐(0) 编辑