ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc

后端 未结 4 1373
暖寄归人
暖寄归人 2020-11-29 00:43

ARC forbids Objective-C objects in structs or unions despite marking the file -fno-objc-arc? Why is this so?

I had the assumption that if you mark it -fno-objc-arc y

4条回答
  •  攒了一身酷
    2020-11-29 00:56

    Looks like this now works without errors, probably after this change.

    i.e., You can put normal (strong) pointers to Objective-C objects in a C struct. It is managed by ARC e.g., it is unretained when the struct is destructed. Verified with:

    $ clang --version Apple LLVM version 10.0.0 (clang-1000.11.45.2)

提交回复
热议问题