• 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: Mysterious warning (initialization from distinct Objective-C type)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mysterious warning (initialization from distinct Objective-C type)


  • Subject: Re: Mysterious warning (initialization from distinct Objective-C type)
  • From: Chris Hanson <email@hidden>
  • Date: Wed, 21 Sep 2005 21:35:06 -0700

On Sep 21, 2005, at 6:26 AM, Mason Mark wrote:

NSDecimalNumber *now = [NSDecimalNumber numberWithDouble: [NSDate timeIntervalSinceReferenceDate]];

NSDecimalNumber inherits the declaration of +numberWithDouble: from its superclass, NSNumber. +[NSNumber numberWithDouble:] is defined to return an NSNumber, not necessarily an NSDecimalNumber.


What you're doing in the line above is "downcasting" a less-specific class (the NSNumber that +numberWithDouble: returns) to a more- specific class (the NSDecimalNumber that you declared the variable to be).

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Mysterious warning: (From: Dan Wood <email@hidden>)
 >Re: Mysterious warning (initialization from distinct Objective-C type) (From: Mason Mark <email@hidden>)
 >Re: Mysterious warning (initialization from distinct Objective-C type) (From: Cameron Hayne <email@hidden>)
 >Re: Mysterious warning (initialization from distinct Objective-C type) (From: Mason Mark <email@hidden>)
 >Re: Mysterious warning (initialization from distinct Objective-C type) (From: Cameron Hayne <email@hidden>)
 >Re: Mysterious warning (initialization from distinct Objective-C type) (From: Cameron Hayne <email@hidden>)
 >Re: Mysterious warning (initialization from distinct Objective-C type) (From: Mason Mark <email@hidden>)

  • Prev by Date: Re: Mysterious warning (initialization from distinct Objective-C type)
  • Next by Date: Japanese Language Support
  • Previous by thread: Re: Mysterious warning (initialization from distinct Objective-C type)
  • Next by thread: Re: Mysterious warning (initialization from distinct Objective-C type)
  • Index(es):
    • Date
    • Thread