<?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>Compiler warning - why?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/19632/compiler-warning---why</link><description> 
I am just learning C by starting on modifying an example program
to do what I want it to do. But immediately get warning messages
although the compiled program runs fine. Whenever I declare a
variable I get the following warnings. 

 
Measure.c(153</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/153925?ContentTypeID=1</link><pubDate>Sun, 22 Oct 2006 01:32:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5f4a1850-2601-4e2b-8336-b8a6dda6f29f</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
Dont know what happened to the linebreaks the preview looked OK
before I posted it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/153289?ContentTypeID=1</link><pubDate>Sun, 22 Oct 2006 00:25:43 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:85b0ec3c-ceea-4f59-a16f-1d1d8d87d38a</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks for the info. But I will stay with the integrated editor
for now, unless there are big reasons not to. It&amp;#39;s bad enough trying
to learn C, the environment, the quirks and the ARM chip itself. I
spent a few hours the other day trying to get the RTOS working only
to find out that the standard Startup.S wont work as is. I am more
experienced in Forth and the 8051 family.&lt;/p&gt;

&lt;p&gt;
So far the /* ... */ editing is working fine the compiler has not
wobbled or done anything unexpected.&lt;/p&gt;

&lt;p&gt;
Have a good weekend.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/152595?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2006 14:33:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a7c217c9-6e48-48b3-83ab-250ab313ad95</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
BTW: Did your post just suffer from the mystery missing line
breaks?&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.keil.com/forum/docs/thread8601.asp"&gt;http://www.keil.com/forum/docs/thread8601.asp&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/151817?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2006 14:31:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c4e1263e-0db7-4a09-b717-a678e554876f</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;I have just toured uvision3 and I couldn&amp;#39;t find where you can
select an alternative editor&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
I don&amp;#39;t think you can - you&amp;#39;re stuck with the &amp;quot;integrated&amp;quot;
one.&lt;br /&gt;
However, there&amp;#39;s nothing to stop you using an external editor, and
just using uVision for building, debugging, etc.&lt;br /&gt;
You can set up entries on the Tools menu to launch your own editor,
and you can use the Key Sequences to have in start at the current
location in the current file, etc;&lt;br /&gt;
&lt;a href="http://www.keil.com/support/man/docs/uv3/uv3_dg_toolmnu.htm"&gt;http://www.keil.com/support/man/docs/uv3/uv3_dg_toolmnu.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
There is a certain other 8051 tool vendor whose &amp;quot;IDE&amp;quot; is, in fact,
CodeWirght. By downloading their demo version, you can effectively
get a free Codewright!&lt;br /&gt;
I couldn&amp;#39;t possibly name names here, of course... ;-)&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;As to the nested comments, uvision seems to work fine in all
respects.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Now this is where you can come unstuck with stuff like nested
comments. uVision is not your compiler - so it is perfectly possible
that uVision could be happy to colour your nested comments as you
like it, while the actual compiler would throw them out.&lt;br /&gt;
The same applies to any other editor, of course.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;I dont really like the /* .. */ commenting I find the // ...
gives a cleaner look to the code&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
I entirely agree on that one.&lt;br /&gt;
Shame that // isn&amp;#39;t strictly &amp;quot;ANSI&amp;quot; C, though... :-(&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/151079?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2006 12:18:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2fa3ed08-df85-4593-9714-3f828fe895ad</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Andy, I have just toured uvision3 and I couldn&amp;#39;t find where you
can select an alternative editor. Prior to using uvisions built in
one I used one called UltraEdit which has some neat features. Dont
know if it can color or hide everything between #if .. #endif though.
I dont see myself going down the Codewright route it costs $299. As
to the nested comments, uvision seems to work fine in all respects.
Using the /* .. */ combined with a yellow text gives good visual
feedback that the bit I want excluding is commented out. For what I
am doing now it works fine. I still realise that #if .. #endif is
more useful for other reasons. Also I dont really like the /* .. */
commenting I find the // ... gives a cleaner look to the code anyway.
Would be nice if I could make a macro to save me typing the 4x
&amp;quot;change all&amp;quot; edit commands!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/150583?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2006 03:38:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fe356427-e882-4c92-8879-53a55caa5096</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;I don&amp;#39;t like it because I cannot take advantage of the color
and font settings to help the eye see whats not in the compile
etc.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
So get an editor that &lt;i&gt;does&lt;/i&gt; colour it! ;-)&lt;/p&gt;

&lt;p&gt;
Codewright can hide code that is inactive due to #if&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;I just use the /* ... */ to comment out the chunks&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
But don&amp;#39;t you still end up with the problem of nested
comments:&lt;/p&gt;

&lt;pre&gt;
/* -- Inactive code
   blah;
   blah; // Existing comment is now nested!
   blah;
*/
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Your editor might allow it, but your compiler might not&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/150190?ContentTypeID=1</link><pubDate>Sat, 21 Oct 2006 02:01:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d3ff04fe-fb10-489e-8dd5-ac9a0732d99c</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
yes of course #if #endif works. But being a rebel I have decided
that for commenting chunks of text I don&amp;#39;t like it because I cannot
take advantage of the color and font settings to help the eye see
whats not in the compile etc.&lt;/p&gt;

&lt;p&gt;
With about four careful edit &amp;quot;replace all&amp;quot; commands its easy to
change the /* .... */ style to all //.....&lt;/p&gt;

&lt;p&gt;
Then I just use the /* ... */ to comment out the chunks, and color
it a yellow so that it almost disappears. Works for me.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/149728?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2006 01:52:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7ed6d366-1453-40f6-9aa4-1d1ea2f502c5</guid><dc:creator>alan raj</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;Quite so - as already noted..&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;it certainly &lt;b&gt;should&lt;/b&gt; work! &amp;quot;&lt;/i&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/149215?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2006 01:45:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5a909f8d-9aef-4e65-8fe9-6c684175948e</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;I haven&amp;#39;t tried it but I&amp;#39;m sure it will work. &amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Quite so - as already noted, &amp;#39;C&amp;#39; is case-sensitive, so #IF is not
equivalent to #if&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/134840?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2006 00:09:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:059fba0b-5c0a-4801-b584-0efd76b9299b</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
I realise now what went wrong. I had been writing some assembler
and had used $IF $ENDIF. Then I switched to the C code and switched
to #IF #ENDIF, just didn&amp;#39;t realise what the mistake was. I haven&amp;#39;t
tried it but I&amp;#39;m sure it will work. Thanks for the help.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/123459?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2006 05:39:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:42ca4b9b-6b55-4482-810d-a6c64e40f7bb</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;How about commenting,&lt;/i&gt;&lt;/p&gt;

&lt;pre&gt;
/* int i = 0;
...
stmt 1
/*stmt 3
stmt 4
stmt 5 // */ // Already commented
stmt 7
...

*/
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
1. It&amp;#39;s very messy; 2. You end up with nested comments - which is
probably why it didn&amp;#39;t work for John in the first place. Definitely
better to go for the preprocessor approach:&lt;/p&gt;

&lt;pre&gt;
#if 0
int i = 0;
...
stmt 1
/*stmt 3
stmt 4
stmt 5 // */ // Already commented
stmt 7
...

#endif
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
But we need John to explain why it was that this didn&amp;#39;t work for him
- it certainly &lt;i&gt;&lt;b&gt;should&lt;/b&gt;&lt;/i&gt; work!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/134849?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2006 05:31:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:68f7e25b-4f97-426c-8876-326e9b1bd6ad</guid><dc:creator>alan raj</dc:creator><description>&lt;p&gt;&lt;p&gt;
Yep,&lt;br /&gt;
&amp;quot;this Forum is the only place I can ask&amp;quot;&lt;br /&gt;
Right,&lt;br /&gt;
and the only place where we get whole chunk of programs&lt;/p&gt;

&lt;p&gt;
&amp;quot;I cannot write your programs for you.?&amp;quot;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/112392?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2006 04:03:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:076ce701-8449-4bb1-8f9d-de01d591c913</guid><dc:creator>alan raj</dc:creator><description>&lt;p&gt;&lt;p&gt;
If this is a code with the existing comments,&lt;/p&gt;

&lt;p&gt;
int i = 0;&lt;br /&gt;
...&lt;br /&gt;
stmt 1&lt;br /&gt;
/*stmt 3&lt;br /&gt;
stmt 4&lt;br /&gt;
stmt 5 */ // Already commented&lt;br /&gt;
stmt 7&lt;br /&gt;
...&lt;/p&gt;

&lt;p&gt;
How about commenting,&lt;br /&gt;
/* int i = 0;&lt;br /&gt;
...&lt;br /&gt;
stmt 1&lt;br /&gt;
/*stmt 3&lt;br /&gt;
stmt 4&lt;br /&gt;
stmt 5 // */ // Already commented&lt;br /&gt;
stmt 7&lt;br /&gt;
...&lt;/p&gt;

&lt;p&gt;
*/&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/123457?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2006 03:20:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3b9a09c6-a233-43d1-bc98-38494e71352c</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;the Forum is the only place I can ask&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Try this: &lt;a href="http://c-faq.com/"&gt;http://c-faq.com/&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/112389?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2006 01:48:22 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9e9b37ef-d2df-41da-8fda-c3644b45974f</guid><dc:creator>Jo Leeuwesteijn</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;OK here&amp;#39;s another one how can I comment chunks of C code out
that I don&amp;#39;t want compiled right now inside a function? I tried /*
..... */ But the existing comments stop that working. // on each line
works but thats a pain #IF 0 ..... #ENDIF doesn&amp;#39;t work, is there a
trick or do I have to cut/copy into Notepad for instance?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Why doesn&amp;#39;t #if 0 work? If you&amp;#39;re using #IF try lower case.&lt;/p&gt;

&lt;p&gt;
Some editors have a feature to put comments in front of all
selected line (in Visual Studio it&amp;#39;s ctrl-k-c).&lt;/p&gt;

&lt;p&gt;
You might want to start new threads for different questions to get
more response.&lt;/p&gt;

&lt;p&gt;
Regards,&lt;br /&gt;
Joost&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/112386?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2006 01:45:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0ef57573-86f0-4cfc-ab1a-32c00ae511af</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;#IF 0 ..... #ENDIF doesn&amp;#39;t work&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Remember that &amp;#39;C&amp;#39; is &lt;b&gt;case-sensitive&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
You need to write #if 0 ... #endif&lt;/p&gt;

&lt;p&gt;
This can also be useful for trying-out alternative
approaches:&lt;/p&gt;

&lt;pre&gt;
#if 1
//do it this way
#else
//do it that way
#endif


&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/98535?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2006 00:36:43 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:78053754-5a7e-4078-a185-436c2ca4fc19</guid><dc:creator>Graham Gollings</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks, I was using the variables just to catch some values for
testing. I thought that minn = 0; was enough to keep the compiler
happy. But then I added minn = minn + 1 and the warning has
disappeared. So I know what you mean.&lt;/p&gt;

&lt;p&gt;
OK here&amp;#39;s another one how can I comment chunks of C code out that
I don&amp;#39;t want compiled right now inside a function? I tried /* .....
*/ But the existing comments stop that working. // on each line works
but thats a pain #IF 0 ..... #ENDIF doesn&amp;#39;t work, is there a trick or
do I have to cut/copy into Notepad for instance?&lt;/p&gt;

&lt;p&gt;
Excuse these simple questions, but the Forum is the only place I
can ask. At least I am making some headway into C, which pleases me
at least. Thanks!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/74460?ContentTypeID=1</link><pubDate>Wed, 18 Oct 2006 23:58:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3cc1dc2e-389d-40bb-bffb-93381b935020</guid><dc:creator>alan raj</dc:creator><description>&lt;p&gt;&lt;p&gt;
We can ask C doubts in this forum?&lt;br /&gt;
that s nice,&lt;/p&gt;

&lt;p&gt;
rgds,&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler warning - why?</title><link>https://community.arm.com/thread/47047?ContentTypeID=1</link><pubDate>Wed, 18 Oct 2006 17:13:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:16f3ba8d-14f3-41e1-b791-14482eb1d286</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
The warnings mean exactly what they say: your are assigning a
value to the variable, but you never do anything else with that
variable.&lt;/p&gt;

&lt;p&gt;
So the compiler thinks: what&amp;#39;s the point of having the variable,
and assigning (ie, writing) a value to it, if you never use it for
anything!&lt;/p&gt;

&lt;p&gt;
To be able to say anything more concrete, we&amp;#39;d have to see your
code!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>