Re: SIGBUS on declarations
Re: SIGBUS on declarations
- Subject: Re: SIGBUS on declarations
- From: David Duncan <email@hidden>
- Date: Fri, 24 Aug 2007 10:40:45 -0700
On Aug 24, 2007, at 10:32 AM, Jason Whittle wrote:
NSArray* x = [[NSArray alloc] initWithObjects: [NSNumber
numberWithInt: 1]];
Note the prototype for initWithObjects:
"- (id)initWithObjects:(id)firstObj, ..."
So that means that it takes a variable length parameter list, but
there is no way for it to know what the end of the list is without
you telling it. According to the docs, this list is a "A comma-
separated list of objects ending with nil". So you need to terminate
the list with nil. Your code should be instead:
NSArray* x = [[NSArray alloc] initWithObjects: [NSNumber
numberWithInt: 1], nil];
--
David Duncan
Apple DTS Quartz and Printing
email@hidden
_______________________________________________
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