boot2

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

081-void-call.c (517B)


      1 /* Void-returning function called as an expression statement.
      2  *
      3  * cg-call has-result?=#f skips the unused a0 → frame-slot spill that
      4  * non-void calls always emit. parse-postfix-rest pushes an imm
      5  * placeholder onto the vstack so downstream pop sites (expression
      6  * statement here, comma, for-init/step) stay uniform.
      7  *
      8  * Side effects: each inc(N) bumps a global counter by N.
      9  */
     10 
     11 int g_acc;
     12 
     13 void inc(int x) { g_acc = g_acc + x; }
     14 
     15 int main(void) {
     16     inc(5);
     17     inc(7);
     18     return g_acc;       /* 12 */
     19 }