boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

36-struct-load.c (432B)


      1 // tests/cc-parse/36-struct-load.c — struct member load via real C
      2 // (§D.1 of docs/CC-PUNCHLIST.md). Two int fields at distinct offsets;
      3 // reading both back in distinct positions of the result confirms the
      4 // parser uses the field offset, not 0 for both.
      5 //
      6 // s.a=1; s.b=2; return s.a + s.b*10;  =>  exit 21.
      7 
      8 int main() {
      9     struct S { int a; int b; };
     10     struct S s;
     11     s.a = 1;
     12     s.b = 2;
     13     return s.a + s.b * 10;
     14 }