Re: Compiler Error (expected expression before 'NSArray')
Re: Compiler Error (expected expression before 'NSArray')
- Subject: Re: Compiler Error (expected expression before 'NSArray')
- From: Thomas Wetmore <email@hidden>
- Date: Mon, 15 Feb 2010 11:18:01 -0500
1. Declarations are not allowed in the case portions of switch statements.
2. { ... } is a block, which can occur whereever a statement can.
Tom Wetmore
On Feb 15, 2010, at 11:08 AM, jeremy wrote:
> Why does the following code cause the compiler error "expected expression before 'NSArray'"?
>
> ----
> int i = 0;
> switch (i) {
> case 0:
> NSArray *results;
> break;
> default:
> break;
> }
> ----
>
> Why does the following produce no compiler error, with the addition of curly braces?
>
> ----
> int i = 0;
> switch (i) {
> case 0:
> {
> NSArray *results;
> }
> break;
> default:
> break;
> }
> ----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden