On Sun, Jun 27, 2010 at 12:19 AM, Bill Bumgarner wrote:
>
> On Jun 26, 2010, at 9:14 PM, Tony Romano wrote:
>
> > That's why I asked for an example of what the op question is
>
> http://lists.apple.com/archives/cocoa-dev/2010/Jun/msg01040.html
>
> > This would seem to imply that a __block variabl
On Jun 26, 2010, at 11:09 PM, Tony Romano wrote:
> - (void)_copyOrMoveURLs:(SEL) s opMove:(BOOL)op src:(NSDictionary *)URLs
> completionHandler:(void (^)(NSDictionary *newURLs, NSError
> *error))handler
> {
>
> __block char array1[5];
> array1[0] = 'W';
>
>
>
>>> 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
__
I had a situation where I was accessing a C array from inside a block. It
worked fine until I upgraded to Xcode 3.2.3; then I started to get errors.
--
David Catmull
uncom...@uncommonplace.com
http://www.uncommonplace.com/
___
Cocoa-dev mailing list
The reason for the __block specifier is to allow the variable to be written to.
If the variable remains a const, then the complier can optimize how the block
is stored. If the data is changed, much of the optimization is lost.
-Tony
On Jun 26, 2010, at 8:56 PM, Kyle Sluder wrote:
> On Sat, J
- (void)_copyOrMoveURLs:(SEL) s opMove:(BOOL)op src:(NSDictionary *)URLs
completionHandler:(void (^)(NSDictionary *newURLs, NSError
*error))handler
{
__block char array1[5];
array1[0] = 'W';
NSBlockOperation * foo = [NSBlockOperation
blo
On Jun 26, 2010, at 9:14 PM, Tony Romano wrote:
> That's why I asked for an example of what the op question is
http://lists.apple.com/archives/cocoa-dev/2010/Jun/msg01040.html
> This would seem to imply that a __block variable *can* be a *fixed* length
> array. But when I try to write into such
That's why I asked for an example of what the op question is
Sent from my phone, Thanks Tony
On Jun 26, 2010, at 8:56 PM, Kyle Sluder wrote:
> On Sat, Jun 26, 2010 at 8:51 PM, Tony Romano wrote:
>> OP posted: "This would seem to imply that a __block variable *can* be a
>> *fixed* length
>> ar
On Jun 26, 2010, at 8:56 PM, Kyle Sluder wrote:
> Putting __block variables inside of blocks is completely pointless.
> The purpose of the __block qualifier is to mark variables in the
> enclosing scope to be copied into the block.
Unless you have a Block within the Block and you want to share a
On Sat, Jun 26, 2010 at 8:51 PM, Tony Romano wrote:
> OP posted: "This would seem to imply that a __block variable *can* be a
> *fixed* length
> array. But when I try to write into such an array inside a block, I get a
> compile error, "cannot access __block variable of array type inside block."
Actually, I read this again.
OP posted: "This would seem to imply that a __block variable *can* be a *fixed*
length
array. But when I try to write into such an array inside a block, I get a
compile error, "cannot access __block variable of array type inside block."
In the example I listed below,
On Jun 26, 2010, at 7:48 PM, Tony Romano wrote:
> hmmm. Your saying this doesn't work?
>
> NSBlockOperation * foo = [NSBlockOperation
> blockOperationWithBlock:^{
> __block char array1[5];
>
> array1[0] = 'T';
> }];
>
>
I understand all that. I was providing an example to seek clarity in his
question. But I understand what he is asking now, thanks.
-Tony
On Jun 26, 2010, at 7:50 PM, Dave DeLong wrote:
> That's going to create a new copy of the array every time the block is
> executed, and the array is not a
That's going to create a new copy of the array every time the block is
executed, and the array is not accessible outside of the scope of the block.
Matt was asking about:
__block char array1[5];
NSBlockOperation * foo = [NSBlockOperation blockOperationWithBlock:^{
array1[0] = 'T';
}
Dave
On
hmmm. Your saying this doesn't work?
NSBlockOperation * foo = [NSBlockOperation
blockOperationWithBlock:^{
__block char array1[5];
array1[0] = 'T';
}];
It works fine for me. Are you saying something different?
-
On Jun 26, 2010, at 6:38 PM, Matt Neuburg wrote:
> The docs say: "There are two further restrictions on __block variables: they
> cannot be variable length arrays, and cannot be structures that contain C99
> variable-length arrays."
>
> This would seem to imply that a __block variable *can* be a
16 matches
Mail list logo