Other Parts Discussed in Thread: TEST2, TMS320VC5502
Tool/software: Code Composer Studio
I converted a CCS 3.2 project to CCS 8.0. The converted project throws the following error:
error #175: floating-point value does not fit in required integral type
The error occurs when a type cast is performed on a floating-point constant that is "near" the upper range of a 32-bit signed integer (long). The compiler whines when the floating-point value is between (LONG_MAX - 64) and LONG_MAX. The compiler is happy with integer constants in this range. Here are some examples:
long test1 = (long)2147483583; // OK
long test2 = (long)2147483583.0; // OK
long test3 = (long)2147483583.9; // OK
long test4 = (long)2147483584.0; // error #175
long test5 = (long)2147483584; // OK
long test6 = (long)2147483646; // OK
long test7 = (long)2147483646.0; // error #175
long test8 = (long)2147483646.9; // error #175
long test9 = (long)2147483647.0; // error #175
long test10 = (long)2147483647; // OK
These results were produced with v4.4.1 of cl55.exe.
Is this a compiler bug or a new, stricter interpretation of some implicit conversion rule?