|
|
|
|
|
by otabdeveloper4
700 days ago
|
|
Void means "it is a syntax error to construct a value of this type". This is not a type that exists in category theory or Haskell. (But similar to the "bottom" type.) Hence, "void*" - a pointer to something, but it would be a syntax error to derefence this pointer. |
|
Differently to other incomplete types void has some special behaviour: you can declare a function as returning void and return with no arguments is also special cased. You can also cast to void.
A void with proper unit semantics would simply be a complete type instead. The only special case would be return with no arguments implicitly returning a void instance, but that would be pure sugar.