This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/EK-TM4C1294XL: EK-TM4C1294XL

Part Number: EK-TM4C1294XL

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

  • Regarding ...

    Charles Moori said:
    "integer conversion resulted in a change of sign"

    I presume the definition of I8 is something similar to ...

    typedef char I8;

    You probably think this is a signed type.  However, the signness of plain char is not specified by the standards, and the TI ARM compiler defines it to be unsigned.

    I recommend you avoid the issue altogether.  Use the types from standard header file <stdint.h> .  Something like this ...

    #include <stdint.h>
    typedef int8_t I8;

    Regarding ...

    Charles Moori said:
    "enumerated type mixed with another type"

    I am unable to reproduce that behavior.  For one source file that gets that diagnostic, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Charles Moori said:
    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)

    #include <stdbool.h>

    No need to add your Boolean *.h file into Tivaware project

  • Please submit the test case I requested at the end of my previous post.

    Thanks and regards,

    -George

  • Since it has been a while, I presume you have resolved the problem.  I'd appreciate hearing how you resolved it.

    Thanks and regards,

    -George