Skip to content

Instantly share code, notes, and snippets.

@TrigDevelopment
Created March 22, 2021 11:57
Show Gist options
  • Select an option

  • Save TrigDevelopment/634aac3f6a0ce305a462e3f3cb376c6d to your computer and use it in GitHub Desktop.

Select an option

Save TrigDevelopment/634aac3f6a0ce305a462e3f3cb376c6d to your computer and use it in GitHub Desktop.
struct container {
int counter;
};
/*@ requires \valid(some_container);
requires some_container->counter == 0;
ensures \result->counter == \at(\result->counter, Pre) + 1;
*/
struct container * f(struct container * some_container) {
some_container->counter = 1;
return some_container;
}
/*@ ensures \result->counter == 1;
*/
struct container * a() {
struct container some_container;
some_container.counter = 0;
return f(&some_container);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment