I want the offsetof() the param line in mystruct1
. I've tried
offsetof(struct mystruct1, rec.structPtr1.u_line.line)
and also
offsetof(struct mystruct1, line)
but neither works.
union {
struct mystruct1 structPtr1;
struct mystruct2 structPtr2;
} rec;
typedef struct mystruct1 {
union {
struct {
short len;
char buf[2];
} line;
struct {
short len;
} logo;
} u_line;
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…