Professional Documents
Culture Documents
Portable Integer Data Types in C (Uint8like)
Portable Integer Data Types in C (Uint8like)
Integer Family
o char
o short
o int
o long
Float Family
o float
o double
Bitsize of each data type is not common in all the C compilers (Native/ Cross)
Native Compiler (s)
o Compiler designed for General Purpose OS like Windows or Linux
Turbo C
Borland C
Cygwin
TDM-GCC
and more …..
Cross Compiler (s)
o Compiler designed for a specific embedded platform using Microcontroller/ SoC
Keil C51
Keil ARMCC
AVR GCC
ARM CC
IAR ARM
and more …
Every compiler tool chain provides a portable integer data type specific header file stdint.h.
Portable integer data types across C Compilers (Native/ Cross):
int8_t
o signed 8-bit data type
uint8_t
o unsigned 8-bit data type
int16_t
o signed 16-bit data type
uint16_t
o unsigned 16-bit data type
int32_t
o signed 32-bit data type
uint32_t
o unsigned 32-bit data type
int64_t
o signed 64-bit data type
uint64_t
o unsigned 64-bit data type
In every C file in the project, we need to include stdint.h to make use of these portable types.
In real world applications, Integer Data can be
Raw Data
o Needed during Core Platform Drivers
binary
Hexadecimal
o unsigned keyword to be specified along with data type
unsigned keyword already added for portable data types
Decimal Data
o signed/ unsigned keyword to be specified along with data type
signed/ unsigned keyword already added for portable data types
o Signed
Data can be negative, 0 and positive
o Unsigned
Data can be 0 and positive
String/ ASCII Data (128 in total)
o Alphanumeric and Special Character ASCII Data
‘A’ to ‘Z’
‘a’ to ‘z’
‘0’ to ‘9’
Special Characters
‘+’
‘-‘
..and more
o Data Type preferred is char
o String is an array of characters