Atmel CAVR-4 ユーザーズマニュアル
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
CAVR-4
Part 2. Compiler reference
Data representation
139
The char type
The
char
type is by default unsigned in the compiler, but the
--char_is_signed
compiler option allows you to make it signed. Note, however, that the library is compiled
with the
with the
char
type as unsigned.
The wchar_t type
The
wchar_t
data type is an integer type whose range of values can represent distinct
codes for all members of the largest extended character set specified among the
supported locals.
supported locals.
The
wchar_t
data type is supported by default in the C++ language. To use the
wchar_t
type also in C source code, you must include the file
stddef.h
from the
runtime library.
Note: The IAR CLIB Library has only rudimentary support for
wchar_t
.
Bitfields
In ISO/ANSI C,
int
and
unsigned
int
can be used as the base type for integer
bitfields. In the AVR IAR C/C++ Compiler, any integer type can be used as the base type
when language extensions are enabled.
when language extensions are enabled.
Bitfields in expressions will have the same data type as the integer base type.
By default, the compiler places bitfield members from the least significant to the most
significant bit in the container type.
significant bit in the container type.
By using the directive
#pragma
bitfields=reversed
, the bitfield members are
placed from the most significant to the least significant bit.
FLOATING-POINT TYPES
In the AVR IAR C/C++ Compiler, floating-point values are represented in standard
IEEE format.
IEEE format.
The ranges and sizes for the different floating-point types are:
Type
Size
Range (+/-)
Exponent
Mantissa
float
32 bits
±1.18E-38 to ±3.39E+38
8 bits
23 bits
double
*
32 bits (default)
±1.18E-38 to ±3.39E+38
8 bits
23 bits
double
*
64 bits
±2.23E-308 to ±1.79E+308
11 bits
52 bits
long double
*
32 bits
±1.18E-38 to ±3.39E+38
8 bits
23 bits
long double
*
64 bits
±2.23E-308 to ±1.79E+308
11 bits
52 bits
Table 32: Floating-point types