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

global variable declaration without giving type identifier generates no warning

I thing it should generate a warning.
but it doesn't.
C51 COMPILER V8.16
Compiler settings: level=2

#include<something.h>

my_strange_global_variable = 1;

void main(void)
{ ...;
}

C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)

Parents
  • So how can you make your assertion that Keil should give a warning!

    There are very few Warnings that are mandated by the standards - it is generally just a choice of the particular compiler to give a warning or not.
    Obviously, different compilers make different choices.

    If you really want to catch (potential) problems like this, you should be using a static analyser; eg, Lint

    "Give me some links that proves there is one dominating 'standard'"

    The standards are the ISO standards (formerly ANSI); the standards supported by Keil are listed here:

    http://www.keil.com/product/isoansi.asp

Reply
  • So how can you make your assertion that Keil should give a warning!

    There are very few Warnings that are mandated by the standards - it is generally just a choice of the particular compiler to give a warning or not.
    Obviously, different compilers make different choices.

    If you really want to catch (potential) problems like this, you should be using a static analyser; eg, Lint

    "Give me some links that proves there is one dominating 'standard'"

    The standards are the ISO standards (formerly ANSI); the standards supported by Keil are listed here:

    http://www.keil.com/product/isoansi.asp

Children