Comments (5)
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.
from objfw.
Fixed.
from objfw.
One more problem I found.
Two different blocks, that's capture single __block variable, does not share value of that variable.
We have variable __block int i = 2;
If first block do some thing like this i--;
In the second block variable "i" is still equal 2
from objfw.
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:
#import <ObjFW/ObjFW.h>
typedef void (^voidblock)(void);
static OFArray*
test()
{
__block double d = 0;
voidblock block1 = Block_copy(^ {
d++;
});
voidblock block2 = Block_copy(^ {
of_log(@"%f", d);
});
return @[block1, block2];
}
int
main()
{
OFArray <voidblock> *t = test();
t[0]();
t[1]();
return 0;
}
from objfw.
Yes, it's work for now.
Tested build with latest changes.
Thanks.
from objfw.
Related Issues (20)
- Support for structs in -[NSInvocation invoke] on x86_64/SysV HOT 1
- Create an objfw.library for AmigaOS/MorphOS HOT 1
- [utils/ofhttp] Average the speed and ETA HOT 1
- [utils/ofhttp] Multi-stream downloads HOT 1
- Add documentation for runtime functions HOT 1
- [OFDNSResolver] Support for URI records HOT 1
- [OFProcess] Support for retrieving the exit code HOT 2
- [runtime] Add objc_setAssociatedObject() HOT 1
- Write assembly for dispatch on MIPS64/N32 HOT 1
- Write assembly for forwardingTargetForSelector: on MIPS64/N32 ABI HOT 1
- [OFStream,OFRunLoop] Notification of OFStream readiness to read, EOF HOT 3
- [OFStream] atEndOfStream - read()/recv() returning 0 shouldn't mean stream is permanently atEnd HOT 2
- [OFProcess] posix_spawnp failure sets an unspecified PID, which `- close` attempts to kill HOT 2
- AUR package HOT 8
- Support OOB data for TCP HOT 1
- Review all APIs before 1.0 release HOT 1
- Automated test for OFProcess HOT 1
- [question] Metal HOT 1
- ObjFW and llvm-mingw HOT 7
- amiga-gcc, NDK3.2 and ObjFW HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objfw.