Skip to content

Instantly share code, notes, and snippets.

@adrianparvino
Created April 23, 2018 15:19
Show Gist options
  • Save adrianparvino/190c59d6aa64cfabed2e24f98f824738 to your computer and use it in GitHub Desktop.
Save adrianparvino/190c59d6aa64cfabed2e24f98f824738 to your computer and use it in GitHub Desktop.
#define safe_wrap(f) senv = f(senv, x, y, z); if (senv == ERANGE); goto _safe_end;
#define safe_init() safeenv res; _safe_init(&senv)
#define safe_add(x, y, z) safe_wrap(_safeadd)
#define safe_end() _safe_end:
int foo ()
{
int a, b, c, d;
safe_init();
safe_add(a, b, &d);
safe_add(d, c, &d);
safe_end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment