C89标准中的哪个部分允许"隐式整数"规则?

Vic*_*tor 12 c standards c89 language-lawyer implicit-int

使用时gcc,代码:

register a = 3;
static b = 3;
Run Code Online (Sandbox Code Playgroud)

-std=c89 -pedantic-errors虽然有警告,但在使用旗帜时允许使用它.

但是它会收到-std=c99 -pedantic-errors标志错误.

我想知道C89标准的哪一部分允许"隐含整数"规则?

Sha*_*our 15

在C89 中允许隐式int规则的部分将是3.5.2 类型说明符,它表示(强调我的):

int,signed,signed int 或no type specifiers

Keith Thompson在评论中指出,在C90中,该部分是6.5.2并且说,唯一的区别是ISO要求的一些介绍性材料,导致部分的重新编号.

在改变了的C99中,该部分是6.7.2 Type说明符,它说:

int,signed或signed int

这也包含在文档N661中:在声明中禁止隐式"int",其中说:

6.5.2类型说明符的变化; 在约束的第一段开头添加新句子:在声明中的声明说明符中至少应给出一个类型说明符.

    Change in 6.5.2 Type specifiers, Constraints, from:
            -- int, signed, signed int, or no type
               specifiers
    to:
            -- int, signed, or signed int
Run Code Online (Sandbox Code Playgroud)

  • 1989 ANSI C标准中的3.5.2节是1990 ISO C标准中的6.5.2节.(这两个标准描述了完全相同的语言.唯一的区别是ISO要求的一些介绍性材料,导致部分重新编号.) (4认同)