implicit-int

Which section in C89 standard allows the “implicit int” rule?

耗尽温柔 提交于 2019-12-17 12:18:08
问题 While using gcc , the code: register a = 3; static b = 3; it is allowed while using the -std=c89 -pedantic-errors flags, although there is a warning. However it receive an error with the -std=c99 -pedantic-errors flags. I wonder which section of the C89 standards allows the "implicit int" rule? 回答1: The section that allowed the implicit int rule in C89 would be section 3.5.2 Type specifiers which says ( emphasis mine ): int , signed , signed int , or no type specifiers Keith Thompson in the

C Compiler not throwing error when no type is specified

做~自己de王妃 提交于 2019-12-01 06:05:56
Why this below program not throwing an error: dfljshfksdhfl; #include <stdio.h> int main () { return 0; } gcc would just throw a warning: test.c:1:1: warning: data definition has no type or storage class [enabled by default] Shafik Yaghmour This is because even though implicit int is no longer part of the C standard since C99 some compilers still support it, mainly to prevent breaking a lot of old code. So this line: dfljshfksdhfl; ends up being equivalent to: int dfljshfksdhfl; clang gives us a much more informative warning by default: warning: type specifier missing, defaults to 'int' [

C Compiler not throwing error when no type is specified

三世轮回 提交于 2019-12-01 04:06:26
问题 Why this below program not throwing an error: dfljshfksdhfl; #include <stdio.h> int main () { return 0; } gcc would just throw a warning: test.c:1:1: warning: data definition has no type or storage class [enabled by default] 回答1: This is because even though implicit int is no longer part of the C standard since C99 some compilers still support it, mainly to prevent breaking a lot of old code. So this line: dfljshfksdhfl; ends up being equivalent to: int dfljshfksdhfl; clang gives us a much