Created
November 26, 2014 19:26
-
-
Save kaworu/a00ab9269c06d08f8850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <Block.h> | |
typedef void (^vblock)(void); | |
vblock | |
f(void) | |
{ | |
__block int x = 42; | |
__block int *y = &x; | |
printf("x=%d, *y=%d, %s\n", x, *y, (y == &x ? "yeah!" : "arg!")); | |
return Block_copy(^ { | |
printf("x=%d, *y=%d, %s\n", x, *y, (y == &x ? "yeah!" : "arg!")); | |
}); | |
} | |
int | |
main(int argc, char **argv) | |
{ | |
vblock b = f(); | |
b(); | |
Block_release(b); | |
} |
Author
kaworu
commented
Nov 26, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment