1

I have seen the following code:

struct orb_metadata {
    const char *o_name;     /**< unique object name */
    const size_t o_size;        /**< object size */
};

#define ORB_DEFINE(_name, _struct)          \
    const struct orb_metadata __orb_##_name = { \
        #_name,                 \
        sizeof(_struct)             \
    }; struct hack

I could understand the MACRO part where a new orb_metadata is created and initialized. But what is this struct hack?

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
Nyaruko
  • 4,329
  • 9
  • 54
  • 105

0 Answers0