Is Uint16, Uint8, etc allowed for MSP430 code writing?
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.
Of course. High quality code implementations never use the built-in type names (int, short, etc.) when defining variables. Instead, type names are used that clearly express the programmer's intention for use of the type. Such names are created by using the typedef keyword.
If you don't already have any such type names, I recommend you use the ones in the standard header file stdint.h. An internet search on stdint.h will give you more information.
Thanks and regards,
-George
I believe Uint8, Uint16, etc are from TI's tistdtypes.h for their DSPs and not in the MSP430 include library. The stdint.h uses uint8_t, uint16_t. I have seen others use u8, u16, etc. Windows uses their own version as well. Defining your own types include file might be best is you have a lot of cross-platform code.
Norman Wong said:Defining your own types include file might be best is you have a lot of cross-platform code.
The whole point of stdint.h is to make this unnecessary.
Thanks and regards,
-George
I am all for using stdint.h as the preferred standard type include definition. It's just not defined with every compiler on every processor. Wish it was. For example, the compiler libraries for the TI's DSP and OMAPs do not supply a stdint.h. If you have to write your own stdint.h file, it might as well be your own that can be used across platforms. I guess one could use your own stdint.h if none is available. Makes for some complicated conditional includes if you'rr trying to make portabe code. TI's own DSPBIOS/SYSBIOS and derived products does not use stdint.h. Users of those products find it simply easier to use the types as defined for OS usage rather than using stdint.h types. Avoids all the mental cross-referencing and casting to get stuff in and out of the OS.
Norman Wong said:For example, the compiler libraries for the TI's DSP and OMAPs do not supply a stdint.h.
All recent TI compiler releases include stdint.h. For MSP430, stdint.h has been available since release 1.0.0, which was six years ago. Are you using a very old version of some other target?
I last tried using stdint.h on Code Composer 3.? for the C6747. Probably too old of a version or maybe I did not setup the include path properly. Used tistdtypes.h to match the DSPBIOS convention and style. I stand corrected. Sorry for hijacking this thread.