There is an isomorphism between any two such sets, so it is customary to talk about the unit type and ignore the details of its value.
It should not be confused with the zero or empty type, which allows no values and is the initial object in this category.
The void type that is used in some imperative programming languages serves some of its functions, but because its carrier set is empty, it has some limitations (as detailed below).
Instead, 'void' is used in a manner that simulates some, but not all, of the properties of the unit type, as detailed below.
This problem is best illustrated by the following program, which is a compile-time error in C: This issue does not arise in most programming practice in C, because since the void type carries no information, it is useless to pass it anyway; but it may arise in generic programming, such as C++ templates, where void must be treated differently from other types.
In C++ however, empty classes are allowed, so it is possible to implement a real unit type; the above example becomes compilable as: (For brevity, we're not worried in the above example whether the_unit is really a singleton; see singleton pattern for details on that issue.)