Hacker News new | ask | show | jobs
by o11c 714 days ago
Due to the way lifetimes work in C (they begin with the block, not the declaration), the following is legal:

  #include <stdio.h>
  #include <stddef.h>

  int main()
  {
      {
          int *p = NULL;
          if (p)
          {
          what:
              printf("a = %d\n", *p);
              return 0;
          }
          int a = 123;
          p = &a;
          goto what;
      }
  }