我阅读了redis的代码,它定义了一个结构:
typedef struct zskiplistNode {
robj *obj;
double score;
struct zskiplistNode *backward;
struct zskiplistLevel {
struct zskiplistNode *forward;
unsigned int span;
} level[];
} zskiplistNode;
它创建这样的节点:
zskiplistNode *zn = zmalloc(sizeof(*zn)+level*sizeof(struct zskiplistLevel));
这是否意味着,如果地址zn
是0x10000
,那么&(zn->level[0])
是0x10000+sizeof(zskiplistNode)
,数组的内存地址在结构后面?