【发布时间】:2018-03-08 12:23:32
【问题描述】:
在C语言中,static const和const static在变量声明上有区别吗?
const static 给出warning: 'static' is not at beginning of declaration。
这不是我的代码,我看到的所有其他问题都是关于 C++ 的,static 在那里有不同的含义。
【问题讨论】:
-
我不太确定这是不是重复的。这个问题询问 storage-class specifiers 和 type-qualifiers 的顺序。 That question 询问 storage-class specifiers 和 type-specifiers 的顺序。它们是不同的,标准对它们的描述也不同。请注意,6.7.3 表示类型限定符的顺序无关紧要,但 6.7.2 仅表示可以使用任何顺序;它并没有说顺序无关紧要。这可能是一个疏忽,但这是一个应该解决的差异。
-
您应该显示导致警告的确切声明。另见Order of defining types