stdatomic.h 的名称是否与句点之前映射到八个有效字符的(潜在)限制相矛盾?

Does name of stdatomic.h contradict with (potential) restriction of the mapping to eight significant characters before the period?

ISO/IEC 9899:2011 (E):

6.10.2.5

The implementation may ignore distinctions of alphabetical case and restrict the mapping to eight significant characters before the period.

由于stdatomic.h在句点之前有9个字符,是否与上面的(潜在)限制矛盾? IE。某些实现在将 stdatomic.h 和(例如)stdatomix.h 用作 #include 指令的参数时不会区分它们?

额外问题:为什么 stdatomic.h 而不是 atomic.h

如果您使用 #include <stdatomic.h>,则库头 包括在内。但是可以自由地使用 #include <stdatomi.h>#include <stdatomix.h>

做同样的(或不做)

但是 #include <stdatom.h> 被视为不同的文件。但另一方面,没有任何内容明确禁止实现具有仅内容为 #include <stdatomic.h> 的文件 stdatom.h。并不是说任何实现都会这样做,但这是允许的。

这里没有真正的矛盾。只是一个有趣的结果。

The implementation may ignore distinctions of alphabetical case and restrict the mapping to eight significant characters before the period.

由于stdatomic.h在句点之前有9个字符,它是否构成一个 与上述(潜在)限制矛盾?

不,因为虽然它使用了“限制”一词,但它并不是对语言或实现的限制。这是授予实施的自由。

I.e. that some implementations will not distinguish between stdatomic.h and (for example) stdatomix.h when using them as argument for #include directive?

实现不区分这两者,因为包含文件名不会使其无法以任何方式符合。该标准指定了格式为

的 include 指令的特殊意义
#include <stdatomic.h>

。只要实现识别该指令并赋予它所需的重要性,就标准而言是否

无关紧要
#include <stdatomix.h>

赋予同等意义。

Extra question: why stdatomic.h and not atomic.h?

尽管不是普遍遵守的约定,但在标准库头文件的名称前加上“std”是一种常见约定。其他示例包括 stdalign.hstdarg.hstdbool.hstddef.hstdint.hstdio.hstdlib.hstdnoreturn.h .我不确定委员会对此的政策,但肯定的影响之一是减少添加到标准库的新头文件的名称与现有项目使用的头文件名称冲突的可能性。