GNU89, mixed declarations and loop initial declarations

后端 未结 1 1690
你的背包
你的背包 2020-12-19 18:34

The default C dialect for GCC and ICC is GNU89. GNU89 allows mixed declarations e.g.

int i;
i = 0;
int j;

I inferred (incorrectly) from a

相关标签:
1条回答
  • 2020-12-19 19:07

    Mixed declarations and statements predate C89 in other languages (e.g., Algol 68) and was a common extension among a few C89 compilers (not MSCV).

    Counter variable declaration in a for statement on the other hand came in C through C++98 and to my knowledge no C89 compiler found it useful enough to add it as a C89 extension.

    0 讨论(0)
提交回复
热议问题