• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C arrays as __block variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C arrays as __block variables


  • Subject: Re: C arrays as __block variables
  • From: Bill Bumgarner <email@hidden>
  • Date: Sun, 27 Jun 2010 11:33:03 -0700

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';
>
>
> 		NSBlockOperation * foo = [NSBlockOperation blockOperationWithBlock:^{
> 			array1[1] = array1[0];
> 				char b = array1[0];
> 					NSLog(@"char %c %c %c", array1[0], array1[1], b);
>
> 			}];
> }
>
> Works fine using 3.2.2	prints out char W W W

And it will [correctly] break in 3.2.3 (or a later compiler  -- LLVM top-of-tree, for example).

It is only working by coincidence.   You can construct a form that doesn't work, if you are creative.

b.bum
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >C arrays as __block variables (From: Matt Neuburg <email@hidden>)
 >Re: C arrays as __block variables (From: Bill Bumgarner <email@hidden>)
 >Re: C arrays as __block variables (From: Tony Romano <email@hidden>)
 >Re: C arrays as __block variables (From: Bill Bumgarner <email@hidden>)
 >Re: C arrays as __block variables (From: Tony Romano <email@hidden>)
 >Re: C arrays as __block variables (From: Kyle Sluder <email@hidden>)
 >Re: C arrays as __block variables (From: Tony Romano <email@hidden>)
 >Re: C arrays as __block variables (From: Bill Bumgarner <email@hidden>)
 >Re: C arrays as __block variables (From: Tony Romano <email@hidden>)

  • Prev by Date: [Possible Bug] Keyboard causes popover content view to scroll out of bounds
  • Next by Date: Re: Weak-linking a class
  • Previous by thread: Re: C arrays as __block variables
  • Next by thread: Re: C arrays as __block variables
  • Index(es):
    • Date
    • Thread