• 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: incompatible pointer type warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: incompatible pointer type warnings


  • Subject: Re: incompatible pointer type warnings
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Tue, 1 Jun 2004 18:36:56 -0700

Hello...

You are getting the warnings because the numberWithUnsignedLong: class method is declared to return a pointer to a NSNumber, even though the object created when you send the message to NSDecimalNumber is actually a NSDecimalNumber.

NSDecimalNumber has it's own implementation of all the NSNumber numberWith...: methods which create and return NSDecimalNumbers, so there shouldn't be any reason why your code will break in the future.

You can fix the warnings by casting the returned pointers to (NSDecimalNumber *)

microsecondsDN = (NSDecimalNumber *)[NSDecimalNumber numberWithUnsignedLong:microsecondsSinceStartup.hi];

microsecondsDN = [microsecondsDN decimalNumberByAdding: (NSDecimalNumber *)[NSDecimalNumber numberWithUnsignedLong:microsecondsSinceStartup.lo]];


Hope that helps,

Louis


Though my application works, I am getting the following warnings, leading me
to fear future incompatibility:


MicrosecondsController.m:70: assignment from incompatible pointer type
MicrosecondsController.m:72: passing arg 1 of `decimalNumberByAdding:' from
incompatible pointer type

The relevant code:

...
microsecondsDN = [microsecondsDN decimalNumberByAdding:[NSDecimalNumber
numberWithUnsignedLong:(unsigned long)microsecondsSinceStartup.lo]];

...
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Re: Code Guidelines
  • Next by Date: Re: NSMenu and RunLoop?
  • Previous by thread: NSImageRep help please...
  • Next by thread: Re: NSMenu and RunLoop?
  • Index(es):
    • Date
    • Thread