• 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: Array controllers in code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array controllers in code?


  • Subject: Re: Array controllers in code?
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 22 Jul 2010 13:51:24 -0500

On Jul 22, 2010, at 1:20 PM, Amy Gibbs wrote:

> 	double *price, *uom, *cost;

You have declared pointers to double, a scalar type.  "double" is _not_ an object type.

> 	price = [Product valueForKey:@"UOMcost"];
> 	uom = [Product valueForKey:@"purchaseUOM"];

The above is wrong, and the compiler probably complained about it.  -valueForKey: is not returning a double nor a pointer to a double.  Most likely, in your case, it is returning a pointer to an NSNumber object.  You can ask an NSNumber for a double value (which, again, will not be a pointer to a double).

> 	cost = uom/price;

> although the actual calculation won't work, not sure why, example values are price=8.8, uom=25, getting an error:invalid operands to binary?

That's because you are attempting to divide two pointers.  That doesn't make sense.

Regards,
Ken

_______________________________________________

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

  • Follow-Ups:
    • Re: Array controllers in code?
      • From: Amy Gibbs <email@hidden>
References: 
 >Array controllers in code? (From: Amy Gibbs <email@hidden>)
 >Re: Array controllers in code? (From: Jack Nutting <email@hidden>)
 >Re: Array controllers in code? (From: Amy Gibbs <email@hidden>)

  • Prev by Date: Re: Array controllers in code?
  • Next by Date: Re: print object by %@
  • Previous by thread: Re: Array controllers in code?
  • Next by thread: Re: Array controllers in code?
  • Index(es):
    • Date
    • Thread