boot2

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

107-static-file-scope.c (364B)


      1 /* file-scope `static` variable: internal linkage but observable.
      2  * Codegen should still allocate and initialize it. */
      3 
      4 static int counter = 100;
      5 static int bump(void) { counter = counter + 1; return counter; }
      6 
      7 int main(int argc, char **argv) {
      8     if (bump() != 101) return 1;
      9     if (bump() != 102) return 2;
     10     if (counter != 102) return 3;
     11     return 0;
     12 }