Yes! This works of course. If I forego the convenience constructors
and use
[[... alloc] initWith...] followed by a [... release]; at the end
of myFun()
all is good in the world. Thanks all for reminding me of this.
Note that
(a) it is somewhat more error-prone, for by separating the allocation
and releasing you increase the possibility of over/underrelease;
(b) if the code between may raise (or leave the scope prematurely in
any other way), you should use an exception harness (and/or other
means) to prevent leak in such a case (an autoreleased object won't
leak, allocated and not-yet-released one of course would).
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden