kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

attr_p2_01_packed_sizeof.c (341B)


      1 /* Phase 2: __attribute__((packed)) on a record honors the packed layout.
      2  * struct { char a; int b; }: unpacked is 8 (char + 3 pad + int);
      3  * packed is 5 (char + int with no padding).
      4  * Phase 1 returns 8; Phase 2 returns 5. */
      5 struct __attribute__((packed)) S {
      6   char a;
      7   int b;
      8 };
      9 
     10 int test_main(void) { return (int)sizeof(struct S); }