Tool/software: Code Composer Studio
I am writing code for the above board, and when compiling I get a warning:
"integer conversion resulted in a change of sign"
I do not really understand this warning, as according to my understanding in binary interpretation -1 (just for an example) would be 1111 1111, -2 (1111 1110) etc...
BUT you may consider these numbers as 0xFF ... 0xFE etc. but they would be defined as U8 i.e. UNSIGNED INTEGERS...
I8 trfrArrayDefault [4][3] =
{
{ 11, 0, -11}, // 22.5 kHz
{ 6, 0, -6}, // 45 kHz
{ 3, 0, -3}, // 90 kHz
{ 4, 0, -4} // 60 kHz
};
If I modify the code to be:
I8 trfrArrayDefault [4][3] =
{
{ 11, 0, (I8)-11}, // 22.5 kHz
{ 6, 0, (I8)-6}, // 45 kHz
{ 3, 0, (I8)-3}, // 90 kHz
{ 4, 0, (I8)-4} // 60 kHz
};
the warnings disappear. DOES IT MAKE SENSE AT ALL to show a WARNING?????
Other compilers take the above definition without any notes, warnings.. as to my this is very obvious.. Or I am nor scientific enough
--------------------------------------------------------------------------------
Before sending out this e-mail I got another strange thing.
I have a definition in an .h file:
typedef enum
{
false,
true
} boolean;
According to my knowledge WHATEVER IS in the bracket will be of type after the closing bracket, i.e. BOTH false and true become of type boolean. (I had no problem with other compilers regarding this definition)
The CCS gives a warning every time when I use this types:
"enumerated type mixed with another type"
so the statements like the one below
boolean boolret = false;
Will cause the above mentioned warning. I can fix this problem by changing:
U8 boolret = false;
I am just wondering, based on what thought false (and also true) is type of U8 (which is defined as "typedef unsigned char U7;")
I would consider this warning is a SERIOUS mistake in CCS.
Thanks
Charles