The language defines the fundamental types, like bool, integral types, floating point types, etc. It includes the conversion and promotion rules.
The language also defines many compound types, and allows you to create your own. You can provide your own conversion functions, both default conversion and explicit conversion. These include arrays, functions, pointers to various novel things, references to things, classes, unions, enumerations, and pointers to members. You can also create types with templates, with typedef declarations and with using alias declarations.
All of these are a full section of the standard with many individual conversion rules and promotion rules taking a full page or more. Integral promotions and conversions, floating point promotions and conversions, floating-integral conversions, pointer conversion, pointer-to-member conversions, function pointer conversions, Boolean conversions, usual arithmetic conversions, array-to-pointer, function-to-pointer, temporary conversion, qualification conversions, the standard conversion sequence, they're all explained for the fundamental types.
Then there's another full section on user-defined conversions, conversions through constructor objects both implicit and explicit, conversion functions between user types both implicit and explicit, the default behaviors for each, and so on. You can create your own conversion rules, including conversions to fundamental types like your own operator int()
, operator bool()
, or operator mytype()
, whatever other conversion type you want.
The bool type is a fundamental type, it has a defined behavior that meets two-state Boolean logic and also satisfies the hardware machine requirements.
If you are creating your own class, struct, union, enum, typedef, or function signatures, every one of these user-created types must implement the rules for that kind of type as specified in the standard. They are not the Wild West free-for-all, each has standardized rules. They are provided with default operations with the programmer able to specialize the behavior.