Why does NSError need double indirection? (pointer to a pointer)

前端 未结 5 1432
遇见更好的自我
遇见更好的自我 2020-11-30 18:53

This concept seems to trouble me. Why does an NSError object need its pointer passed to a method that is modifying the object? For instance, wouldn\'t just passing a referen

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 19:19

    Alternate statement of what n8gray said:

    Because you're not receiving an object to send messages to; you're creating the object and returning it. You generally need the pointer-to-an-NSError *-variable argument because you can only use the return statement on one thing at a time, and you're already using it with NO.

提交回复
热议问题