<?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>Does compiler initialyse variables to zero?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/22986/does-compiler-initialyse-variables-to-zero</link><description> 
Hi, 

 
I&amp;#39;m new to this forum and would like to know if the Keil compiler
sets declared global and local variables to zero. 

 
If not, is there some command line option to achieve this? 

 
Thanks, 

 
Henk 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Does compiler initialyse variables to zero?</title><link>https://community.arm.com/thread/76060?ContentTypeID=1</link><pubDate>Fri, 07 Mar 2008 02:48:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7a0c8548-b7a1-4feb-9f09-5315cf7b62b7</guid><dc:creator>Matt Lacraty</dc:creator><description>&lt;p&gt;&lt;p&gt;
If you check the startup module you see the code that clears the
memory. If you need to you can modify it to do other stuff like
initialise all uninitialised non-local variables to another
value.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Does compiler initialyse variables to zero?</title><link>https://community.arm.com/thread/51585?ContentTypeID=1</link><pubDate>Thu, 06 Mar 2008 05:39:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:789d6ee1-fe25-4fa4-a0cd-56fff2d3dae3</guid><dc:creator>Christoph Franck</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;local variables to zero.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Local variables are uninizialized by default. The C standard does
not require them to be initialized - it&amp;#39;s up to the programmer to
take care of that.&lt;/p&gt;

&lt;p&gt;
Global variables are initialized to zero during execution of the
startup code. To modify this behavior, modify the startup file
accordingly.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Does compiler initialyse variables to zero?</title><link>https://community.arm.com/thread/51586?ContentTypeID=1</link><pubDate>Thu, 06 Mar 2008 05:28:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:42abc29c-f48a-415d-b505-7c1823afd008</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;a href="http://www.keil.com/support/man/docs/c51/c51_ap_startup.htm"&gt;http://www.keil.com/support/man/docs/c51/c51_ap_startup.htm&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>