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

Variables that overlap in the same memory space possible?

Currently I have a set of structures represented as variables such as:

MYTYPE xdata A;
MYTYPE xdata B;
MYTYPE xdata C;
MYTYPE xdata D;
MYTYPE xdata E;
MYTYPE xdata F;
MYTYPE xdata G;
MYTYPE xdata H;


unfortunately E and G happen to not be used in this version of the software. Is it possible to force E and G to exist in the same space as F (for example)? Abusing the _at_ keyword seemed an exercise in futility (of COURSE it gives an error because you need a constant location that's an int for the compiler).

Any suggestions?
To answer WHY (which I'm sure was asked instantly) it's a matter of only having 1K of xdata space. This of course doesn't solve the issue if one needs to have ALL the variables. I'm just seeing what I can do without making a worse mess.

Thanks for listening (gritting teeth maybe?)

Stephen

Parents
  • The implicate order of things?
    Well unfortunately E and G are referenced in an array of constant pointers. It's not as though I didn't think to eliminate them.
    I was thinking

    #define E F
    #define G F
    


    As another possibility. Truth be told I was hoping to abuse the _at_ operator and do something akin to

    MYTYPE F;
    MYTYPE E _at_ &F;
    MYTYPE G _at_ &F;
    


    unfortunately there is no way to change &F to the literal the compiler expects.

    The suggestions are legitimately thought out, I just was hoping that is what I did not HAVE to do. I guess no matter what I do it will be messy.

    Stephen

Reply
  • The implicate order of things?
    Well unfortunately E and G are referenced in an array of constant pointers. It's not as though I didn't think to eliminate them.
    I was thinking

    #define E F
    #define G F
    


    As another possibility. Truth be told I was hoping to abuse the _at_ operator and do something akin to

    MYTYPE F;
    MYTYPE E _at_ &F;
    MYTYPE G _at_ &F;
    


    unfortunately there is no way to change &F to the literal the compiler expects.

    The suggestions are legitimately thought out, I just was hoping that is what I did not HAVE to do. I guess no matter what I do it will be messy.

    Stephen

Children
No data