Skip to content

Instantly share code, notes, and snippets.

@vaughan0
Created November 5, 2012 15:12
Show Gist options
  • Save vaughan0/4017675 to your computer and use it in GitHub Desktop.
Save vaughan0/4017675 to your computer and use it in GitHub Desktop.
bar (int *array, int offset, int size)
{
__label__ failure;
int access (int *array, int index)
{
if (index > size)
goto failure;
return array[index + offset];
}
int i;
/* ... */
for (i = 0; i < size; i++)
/* ... */ access (array, i) /* ... */
/* ... */
return 0;
/* Control comes here from access
if it detects an error. */
failure:
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment