Re: Why would a defined selector not be found at runtime?
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