开发者

What is the retain/release policy for NSDecimalNumberHandler

开发者 https://www.devze.com 2023-03-25 20:04 出处:网络
If a NSDecimalNumberHandler is created using the following: (id)decimalNumberHand开发者_如何学编程lerWithRoundingMode:(NSRoundingMode)roundingMode scale:(short)scale raiseOnExactness:(BOOL)raiseOnExa

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

精彩评论

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