posted 18 years ago
Adrian,
In the example g doesn't require a cast because what is assigned to it is
1. compile time constant integer (value 13)..(no variables involved), and
2. the constant fits in the type byte.
So the compiler is happy...
whereas variable h is assigned values of another variable(s), which is not considered compile time constant (unless the variable is a final constant)..to the compiler it means that the value of the variable may change while the program is running, so it flags an error.
Hope this helps.
Roopesh.