<?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>Trouble accessing array values</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/20191/trouble-accessing-array-values</link><description> I&amp;#39;m having difficulty accessing a value from an array. Here&amp;#39;s an example of what the code is doing: 
 
 
unsigned char xdata In_Buf[2][70];
unsigned char port;
 
 
 
void main(void){

port = In_Buf[0][0];

.
.
}
 
 
 
port never updates no matter what</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Trouble accessing array values</title><link>https://community.arm.com/thread/123315?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2006 08:01:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7e5e1068-d77f-4731-91ce-2fab9b9ba7c7</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;just a will goess&lt;br /&gt;
if &amp;#39;port&amp;#39; is a rename of SBUF, what you see ios correct&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble accessing array values</title><link>https://community.arm.com/thread/112200?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2006 01:29:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e00a53a9-e092-495f-ba22-037f1c06c636</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;There are specific C rules about what happens when There are locals and globals with the same name.&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
It&amp;#39;s not just &amp;#39;C&amp;#39; - most block-structured high-level languages (HLL) have similar rules.&lt;br /&gt;
&lt;br /&gt;
It&amp;#39;s a bit like the way you can have many fies on your hard drive all with the same &lt;i&gt;name&lt;/i&gt; - you distinguish between them by knowing which &lt;i&gt;folder&lt;/i&gt; (directory) each one is in...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble accessing array values</title><link>https://community.arm.com/thread/98249?ContentTypeID=1</link><pubDate>Mon, 10 Jul 2006 00:50:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a4f2505b-e84a-4557-999c-327cd89e4c96</guid><dc:creator>Neil Kurzmam</dc:creator><description>&lt;p&gt;maybe not strange.  There are specific C rules about what happens when There are locals and globals with the same name.  Lookup &amp;quot;Variable Scope&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble accessing array values</title><link>https://community.arm.com/thread/74180?ContentTypeID=1</link><pubDate>Sun, 09 Jul 2006 22:18:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0277e198-815c-4e47-84ee-7970c610fa78</guid><dc:creator>Paul Horn</dc:creator><description>&lt;p&gt;Steven,&lt;br /&gt;
&lt;br /&gt;
I think I found a possible issue that caused the symptoms I saw - a variable name was used in a function and later was duplicated as a global.  No warning about variable redefinition was given, but this error apparently causes the compiler and/or linker to do some really strange things.  A careful reading of the map file uncovered the problem.  Now that the variables have been corrected things are much more predictable.&lt;br /&gt;
&lt;br /&gt;
Thanks for your help!&lt;br /&gt;
&lt;br /&gt;
Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Trouble accessing array values</title><link>https://community.arm.com/thread/46363?ContentTypeID=1</link><pubDate>Sun, 09 Jul 2006 06:47:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f6aea3d0-d7f0-4ec6-9b6c-6a2882899644</guid><dc:creator>Steven Borley</dc:creator><description>&lt;p&gt;Paul,&lt;br /&gt;
&lt;br /&gt;
I don&amp;#39;t seen anything obvious in the code you posted. Perhaps a more complete (but small) sample would help. I&amp;#39;m thinking that it might relate to how port is being used (could it be that it is getting optimised).&lt;br /&gt;
&lt;br /&gt;
How do you know post never gets updated? have you looked at the resultant assembly code?&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Steven&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>