开发者

What is the retain/release policy for NSDecimalNumberHandler

If a NSDecimalNumberHandler is created using the following:

(id)decimalNumberHand开发者_如何学编程lerWithRoundingMode:(NSRoundingMode)roundingMode scale:(short)scale raiseOnExactness:(BOOL)raiseOnExactness raiseOnOverflow:(BOOL)raiseOnOverflow raiseOnUnderflow:(BOOL)raiseOnUnderflow raiseOnDivideByZero:(BOOL)raiseOnDivideByZero

1) Then is it already retained when it is returned? Or is it autoreleased?

2) And subsequently, should we be responsible for "release"-ing it?


1) Then is it already retained when it is returned? Or is it autoreleased?

It returns an autoreleased object, since the method does not contain new alloc or init on its name, therefore you should retain it.

2) And subsequently, should we be responsible for "release"-ing it?

Since you send it a retain message and you "own" it, therefore you are responsible for sending the release message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜