1
我从来没有见过这种##模式之前和我读过的任何书籍。那么这是什么意思?我无法理解这些作品的代码,涉及##:这是什么##模式在C语言中的意思是
#define DECLARE_STRUCT_MRC_CLASS(sfx, obj_type) \
struct mrc_class ## sfx { \
const char *name; \
list_t subclasses; \
list_t instances; \
size_t size; \
bool initialized; \
void (*create)(obj_type *); \
void (*destroy)(obj_type *); \
}
和
DECLARE_STRUCT_MRC_CLASS(, struct mrc_obj);
#define MRC_CLASS_DECLARE(pfx, obj_type) \
obj_type; \
DECLARE_STRUCT_MRC_CLASS(_ ## pfx, obj_type); \
\
extern struct mrc_class_ ##pfx mrc_class_ ## pfx; \
static inline obj_type * \
pfx ## _create(MPI_Comm comm) \
{ \
return (obj_type *) \
__mrc_obj_create(comm, (struct mrc_class *) &mrc_class_ ## pfx); \
} \
任何澄清表示赞赏。提前致谢!
有关参考文献:http://www.cplusplus.com/doc/tutorial/preprocessor/ – AndyG