Skip to content

Instantly share code, notes, and snippets.

@kaworu
Created November 26, 2014 19:25
Show Gist options
  • Save kaworu/32a97b5af1cdb1de727c to your computer and use it in GitHub Desktop.
Save kaworu/32a97b5af1cdb1de727c to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <Block.h>
typedef void (^vblock)(void);
vblock
f(void)
{
__block int x = 42;
__block int *y = &x;
return Block_copy(^ {
printf("%s\n", (y == &x ? "yeah!" : "arg!"));
});
}
int
main(int argc, char **argv)
{
vblock b = f();
b();
Block_release(b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment