Coercion: Case Studies
Coercion: Case Studies
FORTRAN 77: Only Widening
- INTEGER -> REAL -> COMPLEX or DOUBLE PRECISION
C: Automatic conversion in expressions, parameter
- short -> int
- float -> double (not ANSI C/C++)
C++:
- Expressions: widening only
- Assignment: Widening or narrowing
Ada/Modula-2: Very few mixed expressions o.k
PL/I:
- Can mix integers and characters (value interpreted)
Disadvantages:
- Reduced error detection
- Expensive type check/run time conversion