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
  • I assume they represent
    full diversity of "standards".
    Ansi, C99, GNU C?

    There is only one actual C standard: ISO 9899. But from time to time, that standard is updated. The difference you observed was introduced in one such update, from ISO 9899:1990 (aka C90) to 9899:1999 (aka C99).

    Implicit int was originally allowed by C's inventors, K&R, and kept by C90, but (to my surprise, now that I've actually looked it up), disallowed by C99.

    Last I used it, Keil C51 only claimed support for C90, not C99. So there's nothing wrong with it allowing you to write code relying on implicit int.

    I think that these are just propositions
    not rules and there doesn't exist fully standard compiler.

    You think incorrectly on both counts. ISO C is very much a rule, and there do exist compilers that implement it completely.

Reply
  • I assume they represent
    full diversity of "standards".
    Ansi, C99, GNU C?

    There is only one actual C standard: ISO 9899. But from time to time, that standard is updated. The difference you observed was introduced in one such update, from ISO 9899:1990 (aka C90) to 9899:1999 (aka C99).

    Implicit int was originally allowed by C's inventors, K&R, and kept by C90, but (to my surprise, now that I've actually looked it up), disallowed by C99.

    Last I used it, Keil C51 only claimed support for C90, not C99. So there's nothing wrong with it allowing you to write code relying on implicit int.

    I think that these are just propositions
    not rules and there doesn't exist fully standard compiler.

    You think incorrectly on both counts. ISO C is very much a rule, and there do exist compilers that implement it completely.

Children