I think it is not possible in C but ask to verify this. Is it possible to make arithmetic between structure members without real variable of this type? For example:
typedef struct _s1
{
int a;
int b;
int c;
} T1;
I want to see the offset of "c" member compared to structure beginning. It is easy if I have variable:
T1 str;
int dist = (int)&str.c - (int)&str;
But my structure is too big and it has no member in RAM (only in EEPROM). And I want to make some address calculations but not to define RAM member. I can do the job with structure pointer instead of structure variable (it will cost only 4 bytes) but the case is interesting for me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…