| | Basic facilities - slide 27 : 46 |
Implicit type conversions
"Integral og floating-point types can be mixed freely in assignments and expressions"
- "Fundamental types can be converted to each other in a bewildering number of ways"
- Promotions
- A kind of normalization to certain integer types and floating point types before arithmetic operations
- Usual Arithmetic conversions
- Convert arguments of binary operators to a common type
- Conversion to boolean
- From pointers, integers, and floating point types
- Non-zero value transformed to true and zero to false
- Conversion between integer types
- Unsigned: Cutting off bits
- Signed: Implementation dependent
- Conversion between floating point and integer types
- May cause loss of information, or may be undefined (in case of range problems)