C99变量声明位置写入的位置

Zop*_*per 3 c c99

我知道C99允许声明与代码混合,而不仅仅是在开头,但我试图在ISO/IEC 9899:1999中找到它的位置 - 你能指出我应该搜索的部分吗?

提前致谢.

Kei*_*son 5

该变化在(非规范性)Forward,第xii页中被称为"混合声明和代码".(恕我直言,声明 "代码";它应该说"混合声明和声明".)

它在6.8.2中的复合语句的语法中定义:

compound-statement:
    { block-item-list[opt] }
block-item-list:
    block-item
    block-item-list block-item
block-item:
    declaration
    statement
Run Code Online (Sandbox Code Playgroud)

C89/C90标准中的相应语法是:

compound-statement:
    { declaration-list[opt] statement-list[opt] }
declaration-list:
    declaration
    declaration-list declaration
statement-list:
    statement
    statement-list statement
Run Code Online (Sandbox Code Playgroud)