This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

overlaying struct pointers

as many others, I'm sure, I am DATA space starved. We have, for backwards compatibility to process 'old files" (E1 format) which have the structures with the following pointers:

E1_SEIN  xdata *E1_SEINp;
E1_MAIN  xdata *GE1_MAINp;
E1_TXCH  xdata *GE1_TXCHp;

now when the data is loaded it is immediately recognized which format the data is in and if it is the new E2 format the above structures do not exist, but these do:

 E2_CHIF  xdata *GE2_CHIFp;
E2_DHDR  xdata *GE2_DHDRp;
E2_FTHD  xdata *GE2_FTHDp;

now, since the two formats are mutually exclusive, I could gain 6 DATA slots by overlaying them.
YES, I can do it with a union, but since these pointers are used all over the place this will be rather messy and I would like to use something like:

E1_SEIN  xdata *E1_SEINp;
E1_MAIN  xdata *GE1_MAINp;
E1_TXCH  xdata *GE1_TXCHp;
#define E2_CHIF  xdata *GE2_CHIFp *E1_SEINp
#define E2_DHDR  xdata *GE2_DHDRp *GE1_MAINp
#define E2_FTHD  xdata *GE2_FTHDp *GE1_TXCHp

which, of course do not work.

any 'elegant' way to do this. #define with typecasst"??.

Erik