-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid __block type specifier behavior #44
Comments
Oh wow, this is bad. And while there is a test for __block, it is not thorough enough to catch this. Let me debug this and improve on the test. |
Fixed. |
One more problem I found. |
I cannot reproduce this. Can you check your on the latest version? There were two commits to fix this, maybe you only checked out the first? The following code works for me:
|
Yes, it's work for now. |
On Windows and Mac OS X (and maybe Linux) __block variable behavior is not corresponding to Apple (and Clang) documentation.
Simple code tested on Mac OS:
Linked with ObjFW framework (or dll on Windows):
2016-10-13 00:29:29.416 testclang[13106:4746764] Hello, World!
2016-10-13 00:29:29.417 testclang[13106:4746764] 5256272
2016-10-13 00:29:29.417 testclang[13106:4746764] 5256271
2016-10-13 00:29:29.417 testclang[13106:4746764] 5256272
2016-10-13 00:29:29.417 testclang[13106:4746764] 5256271
Program ended with exit code: 0
Linked only with Foundation:
2016-10-13 00:30:56.425 testclang[13119:4747431] Hello, World!
2016-10-13 00:30:56.426 testclang[13119:4747431] 2
2016-10-13 00:30:56.426 testclang[13119:4747431] 1
2016-10-13 00:30:56.426 testclang[13119:4747431] 1
2016-10-13 00:30:56.426 testclang[13119:4747431] 0
Program ended with exit code: 0
As You can see, in ObjFW case, variable "i" captured by "myBlock" is dead after stack destruction of function "block_t createBlock(void)"
The text was updated successfully, but these errors were encountered: