<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Variables that overlap in the same memory space possible?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22207/variables-that-overlap-in-the-same-memory-space-possible</link><description> 
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</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Variables that overlap in the same memory space possible?</title><link>https://community.arm.com/thread/89007?ContentTypeID=1</link><pubDate>Fri, 18 Apr 2008 04:43:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6f4da65e-0caa-4f34-a5b2-a0ede5e61098</guid><dc:creator>stephen phillips</dc:creator><description>&lt;p&gt;&lt;p&gt;
The implicate order of things?&lt;br /&gt;
Well unfortunately E and G are referenced in an array of constant
pointers. It&amp;#39;s not as though I didn&amp;#39;t think to eliminate them.&lt;br /&gt;
I was thinking&lt;/p&gt;

&lt;pre&gt;
#define E F
#define G F
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
As another possibility. Truth be told I was hoping to abuse the _at_
operator and do something akin to&lt;/p&gt;

&lt;pre&gt;
MYTYPE F;
MYTYPE E _at_ &amp;amp;F;
MYTYPE G _at_ &amp;amp;F;
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
unfortunately there is no way to change &amp;amp;F to the literal the
compiler expects.&lt;/p&gt;

&lt;p&gt;
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.&lt;/p&gt;

&lt;p&gt;
Stephen&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Variables that overlap in the same memory space possible?</title><link>https://community.arm.com/thread/49740?ContentTypeID=1</link><pubDate>Thu, 17 Apr 2008 15:10:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:513de90b-8aee-4c63-8cbf-5d1f6a086660</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;unfortunately E and G happen to not be used in this version of
the software.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
What&amp;#39;s &amp;quot;unfurtunate&amp;quot; about that?&lt;/p&gt;

&lt;p&gt;
And what&amp;#39;s keeping you from simply _removing_ those variables,
then? An #if NEED_FEATURE_E around the definition should work just
fine for that.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Variables that overlap in the same memory space possible?</title><link>https://community.arm.com/thread/51696?ContentTypeID=1</link><pubDate>Thu, 17 Apr 2008 13:44:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:040b3691-5688-4a5e-b27a-a2813039c8a2</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;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&amp;#39;s an int for the compiler).&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
the simnple solution&lt;/p&gt;

&lt;pre&gt;
MYTYPE xdata A;
MYTYPE xdata B;
MYTYPE xdata C;
MYTYPE xdata D;
//MYTYPE xdata E;
MYTYPE xdata F;
//MYTYPE xdata G;
MYTYPE xdata H;
&lt;/pre&gt;

&lt;p&gt;
another solution&lt;/p&gt;

&lt;pre&gt;
MYTYPE xdata A;&lt;br /&gt;
MYTYPE xdata B;&lt;br /&gt;
MYTYPE xdata C;&lt;br /&gt;
MYTYPE xdata D;&lt;br /&gt;
#define  E D&lt;br /&gt;
MYTYPE xdata F;&lt;br /&gt;
#define  G F&lt;br /&gt;
MYTYPE xdata H;
&lt;/pre&gt;

&lt;p&gt;
what I would do&lt;/p&gt;

&lt;pre&gt;
MYTYPE xdata A;
MYTYPE xdata B;
MYTYPE xdata C;
MYTYPE xdata D;
#ifndef ABBREVIATE
MYTYPE xdata E;
#endif
MYTYPE xdata F;
#ifndef ABBREVIATE
MYTYPE xdata G;
#endif
MYTYPE xdata H;
&lt;/pre&gt;

&lt;p&gt;
Erik&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>