News for hackers. Stuff that matters.
Re:Braiding the spaghetti: implementing defer in the preproc... by teo_zero on Monday September 16, 2024 @08:54AM (#41555591)
How would the proposed solution work with this code?

  void foo() {
    char *p = malloc(...);
    defer free(p);
    ...
    {
      FILE *p = fopen(...);
      defer fclose(p);
      ...
    }
    return;
  }
Would it run both deferred statements, each with the correct argument?
Re:Braiding the spaghetti: implementing defer in the preproc... by gustedt on Monday September 16, 2024 @10:09AM (#41556235)
Yes, the visibility rules for variables remain exactly the same. The dependent statement of a defer lives in the same scope as the defer is placed.