如果后跟空格和左括号,C11 关键字“_Atomic”是否算作类型限定符或说明符?

Does the C11 keyword '_Atomic' count as type qualifier or specifier if followed by a whitespace and a left parenthesis?

阅读 C11 标准的 N1570 草案,它在 p.1 上说。 121 关于_Atomic 关键字:

If the _Atomic keyword is immediately followed by a left parenthesis, it is interpreted as a type specifier (with a type name), not as a type qualifier.

现在我想知道,在这种情况下,'immediate' 是什么意思?

我觉得措辞很含糊: 标准保证以下两行代码始终相同吗?

明确:

static _Atomic(type) var;

模棱两可:

static _Atomic (type) var;

空格的插入会破坏左括号的即时性吗?

虽然在第一种情况下,关键字始终是类型说明符,但在第二种情况下,我不确定它是类型说明符还是类型限定符,以及这是一个解释问题还是由标准。我还指的是 'var' 是指针的情况。

_Atomic 作为类型说明符或类型限定符分别显示在第 6.7.2.4 节和 6.7.3 节的语法中。文法用token表示(文法的终结符是C规范定义的token),翻译阶段7(5.1.1.2条款)分析文法:

White-space characters separating tokens are no longer significant. Each preprocessing token is converted into a token. The resulting tokens are syntactically and semantically analyzed and translated as a translation unit.

因此,白色 space 无关紧要。

你的两行代码是一样的; "immediately followed by" 表示下一个阶段 7 标记,而不是源文件中的下一个字符。

我认为这在任何地方都没有明确说明过,但是比较 C 中一个地方的规范是很有启发性的,在这个地方标识符和左括号之间是否存在空格 控制应用两个语法规则中的哪一个:

#define foo(bar) ...  // defines function-like macro 'foo(bar)' with replacement '...'
#define foo (bar) ... // defines object-like macro 'foo' with replacement '(bar) ...'

那是 6.10.3,最容易理解的是按顺序阅读第 9、10 和 3 段

[9] A preprocessing directive of the form

# define identifier replacement-list new-line

defines an object-like macro ...

[10] A preprocessing directive of the form[s]

# define identifier lparen identifier-listopt ) replacement-list new-line
[...two other forms...] 

defines a function-like macro ...

[3] There shall be white-space between the identifier and the replacement list in the definition of an object-like macro.

由此可以得出的推论是,当 C 标准表示在语法中赋予空白意义时,它是明确表示的。当没有这样的明确声明时,您可以假设空格的存在或不存在仅在影响源文本如何划分为标记时才有意义。