C++ struct alignment question

后端 未结 6 830
清歌不尽
清歌不尽 2020-12-05 09:12

I have a predefined struct (actually several) where variables span across 32-bit word boundary. In Linux (and Windows using GCC) I am able to get my structs to pack to the

6条回答
  •  醉话见心
    2020-12-05 09:51

    If it absoloutely defnitely needs to be 6 bytes then define it as 3 shorts and get the data out yourself ... it won't slow things down ... the compiler is just doing this anyway ...

提交回复
热议问题