69,336
社区成员
发帖
与我相关
我的任务
分享
typedef struct META {
char* name; // the name of member
uint16_t type; // member type
uint16_t offset; // offset of member from the type head
union {
struct META* meta; // support the child struct type
int count; // indicate the count of member when the member is a array type
};
char* alias; // alias for the parameter, use the "name" if this is NULL
} META;
static void valueConvert(struct jsonStruct* message, struct META* meta, void* data)
{
int count = 0;
count = (int)meta->meta; /*如何才能使得本行不报错cast from pointer to integer of different size*/
.........
}
typedef struct META {
char* name; // the name of member
uint16_t type; // member type
uint16_t offset; // offset of member from the type head
union {
struct META* meta; // support the child struct type
int count; // indicate the count of member when the member is a array type
} M;
#define count M.count;
#define meta M.meta;
char* alias; // alias for the parameter, use the "name" if this is NULL
} META;
语句改为 count =meta->count
只是权宜之计,最好还是不要这宏,直接写 meta->M.count