Some tutorials define void as a type, but in practice it is just a keyword, a placeholder to express "no type". So if we say that void is not a type practically, is that correct?
Some tutorials define void as a type, but in practice it is just a keyword, a placeholder to express "no type". So if we say that void is not a type practically, is that correct?
The C++ Standard says that void is an incomplete type that cannot be completed (unlike other incomplete types that can be completed).
This means you cannot apply the sizeof operator to void, you can't declare a variable of type void, but you can have a pointer to an incomplete type, and declare a function that return it. In case of the declaration of a return type void,the function has no return.
This is not correct. The keyword void can be used in many places where C++ requires a type, for instance in template arguments. It's syntactically not a placeholder there. Of course, a template author may still decide to treat void as meaning "no type"; it's a common interpretation.
throw expressions explicitly have void type, even though the keyword void is not used there.
Function call expressions can have void type, and the return statement in a void function can take a void expression.