Is __attribute((noescape)) — the Objective-C equivalent of Swift’s @noescape 
attribute — fully implemented yet (as of Xcode 7)? I’m trying to use it to 
avoid that pesky “capturing 'self' strongly in this block is likely to lead to 
a retain cycle” error.

I’ve got a method declared like so, with the ‘noescape’ attribute on the block 
parameter:

- (BOOL) addBytes: (const void*)bytes
           length: (size_t)length
         onOutput: (__attribute__((noescape)) void(^)(const 
void*,size_t))onOutput;

Then I call the method from another method like so:

    [_zipper addBytes: data.bytes length: data.length
             onOutput: ^(const void *bytes, size_t length) {
                 [_writer appendData: [[NSData alloc] initWithBytes ....

But I still get the retain-cycle error, even though the compiler/analyzer 
should be able to tell that no retain cycle is possible since it’s been 
promised that no one will hold onto a reference to the block.

I’ve tried this with Xcode 6.4 and Xode 7 beta 4 and get the same results.
Should I file a Radar or is this already known?

—Jens
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (Xcode-users@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to