此代码在Visual Studio 2019上编译并运行良好(输出5)
#include <iostream>
int main(void) {
alignas(2,3,9,8) int x=5;
std::cout << x;
return 0;
}
in C comma expressions are explicitly disallowed in alignas. This compiled fine here. I changed the order and placed 9 or 3 at the end (which is disallowed in alignas) and the program failed to compiling indicating the expression in the brackets is really being parsed as the comma operator. Is there a different meaning here or is this just VS allowing the programmer to get away with something they shouldn't.
The standard actually says in C11 6.6 emphasis mine:
然后在脚注中: