我想在mystruct1
中获取参数行的offsetof()
。我已经尝试过了。
offsetof(struct mystruct1, rec.structPtr1.u_line.line)
还有
offsetof(struct mystruct1, line)
但都不起作用。
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;
};
struct mystruct2
... - Jonathan Lefflertypedef
。这是一个虚无的用法,因为没有给出名称来成为struct mystruct1
的别名。 - Jonathan Leffler