• 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: Weird build error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird build error


  • Subject: Re: Weird build error
  • From: Chris Suter <email@hidden>
  • Date: Fri, 18 Apr 2008 09:28:59 +1000


On 18/04/2008, at 9:15 AM, Michael Vannorsdel wrote:

Change it to:

- (void)TestFunction
{
	switch (1) {
		case 1:
			{
				NSMutableArray *myArray=[[NSMutableArray alloc] init];
				break;
			}
	}
}

No need to declare default if it's unused. Also you need to bracket the statement in the switch if you're going to declare vars there.

That's one way of solving it, and probably the neatest, but you don't have to solve it that way.


The true cause of the problem is that labels (case labels and goto labels) must be followed by a statement (which isn't a declaration).

So you could solve it by typing the following for example:

  case 1:
	; // empty statement
	NSMutableArray *myArray = [[NSMutableArray alloc] init];

- Chris

_______________________________________________

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: 
 >Weird build error (From: Don Arnel <email@hidden>)
 >Re: Weird build error (From: Michael Vannorsdel <email@hidden>)

  • Prev by Date: Re: Weird build error
  • Next by Date: Re: Weird build error
  • Previous by thread: Re: Weird build error
  • Next by thread: Re: Weird build error
  • Index(es):
    • Date
    • Thread