Struct packing and alignment with mingw

后端 未结 3 1351
别那么骄傲
别那么骄傲 2021-01-12 18:40

I am emulating code from an embedded system (stm32, Keil µVision 5, MDK-ARM) on a PC (mingw32, 32bit arch). The alignment of the ARM compiler does not match my desktop m

3条回答
  •  猫巷女王i
    2021-01-12 19:08

    attribute packed is broken on mingw32 compilers. Another option is to use pragma pack:

    #pragma pack(1)
    typedef struct _file
    {
      uint8_t var1;
      uint16_t var2;
    } FILE;
    

提交回复
热议问题