Atmel CAVR-4 Manual De Usuario

Descargar
Página de 323
CAVR-4
138
Basic data types
AVR® IAR C/C++ Compiler
Reference Guide
Basic data types
 
The compiler supports both all ISO/ANSI C basic data types and some additional types.
INTEGER TYPES
The following table gives the size and range of each integer data type:
Signed variables are represented using the two’s complement form.
Bool 
The 
bool
 data type is supported by default in the C++ language. If you have enabled 
language extensions, the 
bool
 type can also be used in C source code if you include the 
file 
stdbool.h
. This will also enable the boolean values 
false
 and 
true
.
The enum type 
ISO/ANSI C specifies that constants defined using the 
enum
 construction should be 
representable using the type 
int
. The compiler will use the shortest signed or unsigned 
type required to contain the values.
When IAR Systems language extensions are enabled, and in C++, the 
enum
 constants 
and types can also be of the type 
long
 or 
unsigned
 
long
.
Data type 
Size 
Range
Alignment
bool  
8 bits
0 to 1
1
char  
8 bits
0 to 255
1
signed char 
8 bits
-128 to 127
1
unsigned char 
8 bits
0 to 255
1
signed short
16 bits
-32768 to 32767
1
unsigned short  
16 bits
0 to 65535
1
signed int
16 bits
-32768 to 32767
1
unsigned int  
16 bits
0 to 65535
1
signed long 
32 bits
-2
31
 to 2
31
-1
1
unsigned long  
32 bits
0 to 2
32
-1
1
signed long long
64 bits
-2
63
 to 2
63
-1
1
unsigned long long
64 bits
0 to 2
64
-1
1
Table 31: Integer types