Does T D[N] always declare an object of array type?

走远了吗. 提交于 2019-12-05 08:22:11

This is a bug of the wording of the standard. Of course, int (*p)[42]; is not an array type, but satisfies the grammar in [dcl.array]/1 (and does not satisfy the previous grammars in [dcl.meaning]/5, [dcl.meaning]/6, [dcl.ptr]/1, [dcl.ref]/1 or [dcl.mptr]/1), so [dcl.array]/1 should apply.

I have posted an editorial issue.

int (*p)[42];

You said

This declaration satisfies the grammar described above.

When seen that way, *p is an array of 42 int elements, which is true. That fits the type of p just right. It is a pointer to "an array of 42 ints".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!