• 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: Objects Not being added to array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objects Not being added to array


  • Subject: Re: Objects Not being added to array
  • From: Andrew Farmer <email@hidden>
  • Date: Sat, 16 Dec 2006 23:35:28 -0800

On 16 Dec 06, at 23:24, Matthew Callis wrote:
Thanks Nick & Andrew! That fixed the math problem, and for time's sake I
haven't changed to keyed values yet, but the main problem still exist that
the first item in my array isn't added due to flawed logic that I can't seem
to figure out in Objective-C that was done in C++.

<snipped code>

As far as I can tell, it's behaving as written. I'm not quite sure what you're trying to do (removing duplicates?), but right now, it's comparing the first item to itself on the first time through the loop, which is kind of a foregone conclusion. You probably want to special-case the first item: change the if() statement to

if(artistResult != NSOrderedSame || venueResult != NSOrderedSame || i == 0)

Note also that I'm using a symbolic constant, NSOrderedSame, instead of the "magic number" 0. This doesn't affect the way your code works, but it's a good habit to get into.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

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: 
 >Objects Not being added to array (From: "Matthew Callis" <email@hidden>)
 >Re: Objects Not being added to array (From: Nick Zitzmann <email@hidden>)
 >Re: Objects Not being added to array (From: Andrew Farmer <email@hidden>)
 >Re: Objects Not being added to array (From: "Matthew Callis" <email@hidden>)

  • Prev by Date: Howto left side panel like in Mail.app?
  • Next by Date: Re: Howto left side panel like in Mail.app?
  • Previous by thread: Re: Objects Not being added to array
  • Next by thread: Objects not being added to array
  • Index(es):
    • Date
    • Thread