引用cp首选项站点
在函数参数列表中,在数组声明符中允许使用其他语法元素:关键字静态和限定符,它们可以以任何顺序出现在大小表达式之前(即使省略了大小表达式,它们也可以出现).
和
如果存在限定符,则它们限定数组参数类型转换为的指针类型:
int f(const int a[20])
{
// in this function, a has type const int* (pointer to const int)
}
int g(const int a[const 20])
{
// in this function, a has type const int* const (const pointer to const int)
}
但是,上面的代码片段不能使用/std:c17
标志在MSVC V19上编译,并出现错误:
<source>(5): error C2143: syntax error: missing ']' before 'const'
<source>(5): error C2143: syntax error: missing ')' before 'const'
<source>(5): error C2143: syntax error: missing '{' before 'const'
<source>(5): error C2059: syntax error: 'constant'
<source>(5): error C2059: syntax error: ')'
https://godbolt.org/z/8r9388PYn个
这是一个MSVC错误,还是这个规范是可选的?
If this is a m和atory specification can you redirect me to the relative paragraph of the C17 st和ard?