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

Compiler warning - why?

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): warning: #550-D: variable "Minn_flag" was set but never used
Measure.c(62): warning: #550-D: variable "Ret_flags" was set but never used

Ret_Flags is declare as a global at the head of a file, and used in two functions. Minn_flag is declared inside a function and used once. I dont understand because I am declaring and using variables right alongside others already used in the example. Those variables dont get errors, but mine do. I am sure it's basic but what am I doing wrong?

Thanks!

Parents
  • "I don'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."

    So get an editor that does colour it! ;-)

    Codewright can hide code that is inactive due to #if

    "I just use the /* ... */ to comment out the chunks"

    But don't you still end up with the problem of nested comments:

    /* -- Inactive code
       blah;
       blah; // Existing comment is now nested!
       blah;
    */
    


    Your editor might allow it, but your compiler might not

Reply
  • "I don'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."

    So get an editor that does colour it! ;-)

    Codewright can hide code that is inactive due to #if

    "I just use the /* ... */ to comment out the chunks"

    But don't you still end up with the problem of nested comments:

    /* -- Inactive code
       blah;
       blah; // Existing comment is now nested!
       blah;
    */
    


    Your editor might allow it, but your compiler might not

Children
  • Hi Andy, I have just toured uvision3 and I couldn'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 "change all" edit commands!

  • "I have just toured uvision3 and I couldn't find where you can select an alternative editor"

    I don't think you can - you're stuck with the "integrated" one.
    However, there's nothing to stop you using an external editor, and just using uVision for building, debugging, etc.
    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;
    http://www.keil.com/support/man/docs/uv3/uv3_dg_toolmnu.htm

    There is a certain other 8051 tool vendor whose "IDE" is, in fact, CodeWirght. By downloading their demo version, you can effectively get a free Codewright!
    I couldn't possibly name names here, of course... ;-)

    "As to the nested comments, uvision seems to work fine in all respects."

    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.
    The same applies to any other editor, of course.

    "I dont really like the /* .. */ commenting I find the // ... gives a cleaner look to the code"

    I entirely agree on that one.
    Shame that // isn't strictly "ANSI" C, though... :-(

  • BTW: Did your post just suffer from the mystery missing line breaks?

    http://www.keil.com/forum/docs/thread8601.asp

  • Thanks for the info. But I will stay with the integrated editor for now, unless there are big reasons not to. It'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.

    So far the /* ... */ editing is working fine the compiler has not wobbled or done anything unexpected.

    Have a good weekend.

  • Dont know what happened to the linebreaks the preview looked OK before I posted it.