boot2

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

38-arrow.c (409B)


      1 // tests/cc-parse/38-arrow.c — pointer-to-struct field access via real C
      2 // (§D.3 of docs/CC-PUNCHLIST.md). Validates the arrow arm: rval the
      3 // pointer, deref to reach the struct, push-field at the right offset.
      4 //
      5 // p->a=4; p->b=9; return p->b - p->a;  =>  exit 5.
      6 
      7 int main() {
      8     struct S { int a; int b; };
      9     struct S s;
     10     struct S *p = &s;
     11     p->a = 4;
     12     p->b = 9;
     13     return p->b - p->a;
     14 }