struct {...}, , , , - . "" , , , .
, , . , :
#define MAKE_ACME_STRUCT \
FIELD(id,int,23) \
X FIELD(name,char30,"Untitled") \
X FIELD(info,int,19) \
MAKE_ACME_STRUCT , FIELD X , struct, , , [, -
STRUCT_INFO acme_struct_info[] = {
{"id", STRUCT_INFO_TYPE_int, sizeof(ACME_STRUCT.id), offsetof(ACME_STRUCT.id)}
,{"name", STRUCT_INFO_TYPE_char30, sizeof(ACME_STRUCT.name), offsetof(ACME_STRUCT.name)}
,{"info", STRUCT_INFO_TYPE_int, sizeof(ACME_STRUCT.info), offsetof(ACME_STRUCT.info)}
,{0}};
, , , STRUCT_INFO_TYPE_nameGoesHere, , .
Such macros are hardly beautiful, but they have the advantage that all the things they use to determine remain synchronous (for example, adding or removing an element acme_structwill add or remove it from the list of structure elements stored in acme_struct_info].