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
  • 115,525
  • 42
  • 225
  • 281
Nyaruko
  • 4,041
  • 7
  • 45
  • 95

0 Answers0