• 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: Why would a defined selector not be found at runtime?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why would a defined selector not be found at runtime?


  • Subject: Re: Why would a defined selector not be found at runtime?
  • From: Andy Lee <email@hidden>
  • Date: Thu, 12 May 2005 23:03:22 -0400

On May 12, 2005, at 2:06 PM, Douglas Davidson wrote:
The primary reason you should not alloc/init in two steps is that the init may return a different object.

This is a case where discarding a method's return value led to a non-obvious bug. I use an explicit cast when I do that:


   (void)[self returnSomething];

This would have been a hint upon reading the code that perhaps the return value of an -init method *shouldn't* be ignored.

It's easy to forget to do the explicit cast, especially with methods you didn't write. I just submitted a bug asking for an option for gcc to warn that a method return is being discarded without an explicit cast to void.

--Andy

_______________________________________________
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: 
 >Why would a defined selector not be found at runtime? (From: Ken Tozier <email@hidden>)
 >Re: Why would a defined selector not be found at runtime? (From: Ricky Sharp <email@hidden>)
 >Re: Why would a defined selector not be found at runtime? (From: Ken Tozier <email@hidden>)
 >Re: Why would a defined selector not be found at runtime? (From: SA Dev <email@hidden>)
 >Re: Why would a defined selector not be found at runtime? (From: Ken Tozier <email@hidden>)
 >Re: Why would a defined selector not be found at runtime? (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: programming window with textView
  • Next by Date: what's with the "rdar" urls?
  • Previous by thread: Re: Why would a defined selector not be found at runtime?
  • Next by thread: Re: Why would a defined selector not be found at runtime?
  • Index(es):
    • Date
    • Thread