On cppreference.com they classify types as:
- Void types
- Basic types
- Enumerated types
- Derived types
I cannot find the reason why they have classified void as a fundamental type. It implies that there is a difference between basic types like int, char, etc., and the void type. On the basis of whether they are storing values or not, they clearly differ: conceptually, void type denotes objects that do not store any values, but basic-typed objects do store values.
I feel that every classification should have a single and well-defined basis. But here, I feel that there is no single basis.
In my opinion, instead they could have classified them on the basis of whether is it derived or not:
- Basic types (includes
voidas well) - Derived types (types that are derived using the basic types. includes
enumtypes as well)
Here, I classified void as basic type because it is one of the standard types defined in standard and doesn't depend on any other types. I classified enum types as derived types because I viewed that the enum types represent values of int type, therefore concluding that enum types are derived (implicitly) from int type.
What could be there basis of classification? Does my classification makes sense?
How
voiddiffers from other types:voidis incomplete by definition.voidvoidstruct or union membervoidelementsvoidpointerspointersDid I miss something?
Imagine an empty space. You can have this place coordinates (pointer). But do you think that it can be classified the same as planets or stars?