Why can't we declare a variable of type void?

后端 未结 7 1602
盖世英雄少女心
盖世英雄少女心 2020-12-08 09:43

I\'m looking for a formal explanation of that fact in the Standard. I\'ve found what 3.9.1/9 says and trying to give an explanation used that section.

S

相关标签:
7条回答
  • 2020-12-08 10:39

    "void type is an incomplete type"

    You can't create variables of any incomplete type

    "...that cannot be completed"

    While your example of extern incomplete struct can be completed at some later point, the compiler knows that any declaration of type void can never be completed.

    0 讨论(0)
提交回复
热议问题