>>> In the example I listed below, I have a __block variable inside a block that
>>> is fixed length array and I can access it via  NSLog(@"char %c", array1[0]);

Sure, but I'm talking about a __block variable declared outside the block:

    int arr[1];
    ^(){ arr[0];}; // compile error


    __block int arr[1];
    ^(){ arr[0]; }; // compile error!

I think b.bum has explained this thoroughly; the workaround is:

    struct {int arr[1];} str;
    ^(){ str.arr[0];};

And now it can be made writable with __block as expected:

    __block struct {int arr[1];} str;
    ^(){ str.arr[0]=1;};

I would suggest the docs be a bit more forthcoming about this, unless it's
documented and I just didn't spot it. Thx all - m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to