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.

Compiler/TMS570LS0432: int and long data types, difference

Part Number: TMS570LS0432

Tool/software: TI C/C++ Compiler

Hi all,

in our project from the beginning we have been using the following aliases for data types:

typedef signed int sint32_t; /* Signed 32-bits integer (signed int/) */

typedef unsigned int uint32_t; /* Unsigned 32-bits integer (unsigned int) */

Now we faced with a necessity to change it to the following:

typedef signed long sint32_t; /* Signed 32-bits integer (signed long) */

typedef unsigned long uint32_t; /* Unsigned 32-bits integer (unsigned long) */

 

I would like to ask, can we expect some side effect in case of such a change or int/long type are absolutely equal to each other?

Compiler version is TI ARM 18.12.0.

 

Thanks in advance!

 

 

  • The best way to solve this problem is by including this standard header file #include <stdint.h>.  Read about it in your favorite C book, website, etc.

    Thanks and regards,

    -George

  • Hi George,

    thanks for your answer. Standard include file is not the option, within our project we can't use any external code. And as far as I can see unsigned/signed int is used for uint32_t within the mentioned file.

    Afraid to make a mistake, but can I really find somewhere in a book/internet how these types are implemented by the TI compiler?

    Within the SPNU151T I found the following information:

    So for the first look 'signed/unsigned int' is equal to 'signed/unsigned long' for TI ARM 18.12.0 compiler, at least in terms of  the range and representation.

    But are any differences between these type available within the TI ARM compiler?

    We already have quite huge amount of code and don't want to have any side effects in case of data types substitution (int -> long).

    Thanks for your help.

  • Dmitry Tuykov said:
    can I really find somewhere in a book/internet how these types are implemented by the TI compiler?

    That table you found in the ARM compiler manual is the best place to look.

    Dmitry Tuykov said:
    are any differences between these type available within the TI ARM compiler?

    No.  That table is the one and only place the properties of those built-in types are documented.

    Thanks and regards,

    -George

  • Hi George,

    thanks for your answer.

    I tried to generate s-record files for both definitions of sint32_t/uint32_t types (int and long). Result is the same.

    On the other hand .out file is slightly different, but I think it could not lead to any problems.