Locally disable padding

前端 未结 2 1624
傲寒
傲寒 2020-12-09 17:18

I write a parser for some data structure, after hours of debugging I found out that the problem is Visual Studio doesn\'t interpret the structures as I tell it. It seems som

相关标签:
2条回答
  • 2020-12-09 17:26

    Visual Studio 2010 has #pragma pack to do what you're looking for.

    0 讨论(0)
  • 2020-12-09 17:45

    Use the #pragma pack directive for that:

    #pragma pack(push, 1)
    struct foo { 
      // etc..
    };
    #pragma pack(pop)
    
    0 讨论(0)
提交回复
热议问题