In Cocoa, how is the id type defined?

后端 未结 5 971
孤独总比滥情好
孤独总比滥情好 2020-12-09 06:02

This question is out of pure curiosity. How does Cocoa define the id type? Is it just a typedef for a void *? Also, if you know which header file it is defined in, I would b

5条回答
  •  北海茫月
    2020-12-09 06:34

    The id type is generally declared like:

    typedef struct objc_object *id;
    

    This is critical for Objective-C++ where the type is part of a mangled function name.

    You can take a look in /usr/include/objc/objc.h

提交回复
热议问题