Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added void parameter to each function

...

Code Block
bgColor#FFCCCC
jmp_buf buf;

void f(void) {
  int i = setjmp(buf);
  if (i == 0) {
    g();
  } else {
    /* longjmp was invoked */
  }
}

void g(void) {
  /* ... */
  longjmp(buf, 1);
}

...

Code Block
bgColor#ccccff
jmp_buf buf;

void f(void) {
  if (setjmp(buf) == 0) {
    g();
  } else {
    /* longjmp was invoked */
  }
}

void g(void) {
  /* ... */
  longjmp(buf, 1);
}

...

Code Block
bgColor#FFCCCC
jmp_buf buf;

void f(void) {
  g();
  h();
  return;
}

void g(void) {
  if (setjmp(buf) != 0) {
    /* longjmp was invoked*/
  }
  return;
}

void h(void) {
  /* ... */
  longjmp(buf, 1);
}

...

Code Block
bgColor#ccccff
jmp_buf buf;

void f(void) {
  if (setjmp(buf) != 0) {
    /* longjmp was invoked */
  } else {
    h();
  }
  return;
}

void h(void) {
  /* ... */
  longjmp(buf, 1);
}

...

Code Block
bgColor#FFCCCC
jmp_buf buf;

void f(void) {
  int i = 0;
  if (setjmp(buf) != 0) {
    printf("%i\n", i);
    /* ... */
  }
  i = 2;
  g();
}

void g(void) {
  /* ... */
  longjmp(buf, 1);
}

...

Code Block
bgColor#ccccff
jmp_buf buf;

void f(void) {
  volatile int i = 0;
  if (setjmp(buf) != 0) {
    printf("%i\n", i);
    /* ... */
  }
  i = 2;
  g();
}

void g(void) {
  /* ... */
  longjmp(buf, 1);
}

...