• 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: SIGBUS on declarations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIGBUS on declarations


  • Subject: Re: SIGBUS on declarations
  • From: "Sean McBride" <email@hidden>
  • Date: Fri, 24 Aug 2007 13:47:24 -0400
  • Organization: Rogue Research

On 8/24/07 10:40 AM, David Duncan said:

>> 	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];

gcc can warn about this.  With the OP's code it says:

 "warning: missing sentinel in function call"

I forget which exact flag gives you this, but "-Wall" does.  Pity
freshly created Xcode projects have so few warnings enabled.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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: 
 >SIGBUS on declarations (From: Jason Whittle <email@hidden>)
 >Re: SIGBUS on declarations (From: David Duncan <email@hidden>)

  • Prev by Date: NSSplitView / NSWindow resize problem
  • Next by Date: Re: Uppercasing text as it is entered
  • Previous by thread: Re: SIGBUS on declarations
  • Next by thread: NSSplitView / NSWindow resize problem
  • Index(es):
    • Date
    • Thread