2015年2月26日 星期四

C structure on 32bits/64bits compiler

64bits C structure alignment = 8
32Bits C structure alignment  = 4

if u have a data which is building by 32Bits CPU and parsing by 64Bits for structure raw data. it is going to face the different compiler issue.

although the data structure can be fixed the compliler pre-process as #pragma pack(1) to avoid this issue but it is not useful on the complex data structure. In this case, sending of data on different OS must flow the popular data format to avoid the structure raw data problem.

沒有留言:

張貼留言