S5U1C17001C ManUal
EPSOn
6-9
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
6 C COMPilEr
6
Compiler
6.4.2 Data representation
The
xgcc
C compiler supports all data types under ANSI C. Table 6.4.2.1 below lists the size of each type (in bytes)
and the effective range of numeric values that can be expressed in each type.
Table 6.4.2.1 Data type and size
Data type
Size
Effective range of a number
char
1
-128 to 127
unsigned char
1
0 to 255
short
2
-32768 to 32767
unsigned short
2
0 to 65535
int
2
-32768 to 32767
unsigned int
2
0 to 65535
long
4
-2147483648 to 2147483647
unsigned long
4
0 to 4294967295
pointer
4
0 to 16777215
float
4
1.175e-38 to 3.403e+38 (normalized number)
double
8
2.225e-308 to 1.798e+308 (normalized number)
long long
8
-9223372036854775808 to 9223372036854775807
unsigned long long
8
0 to 18446744073709551615
wchar_t
2
0 to 65535
The
float
and
double
types conform to the IEEE standard format.
Handling of
long long
-type constants requires the suffix
LL
or
ll
(
long long
type) or
ULL
or
ull
(
un-
signed long long
type). If this suffix is not present, a warning is generated, since the compiler may not be
able to recognize
long long
-type constants as such.
Example:
long long ll_val;
ll_val = 0x1234567812345678;
→
warning: integer constant is too large for "long" type
ll_val = 0x1234567812345678LL;
→
OK
Type
wchar_t
is the data type needed to handle wide characters. This data type is defined in
stdlib.h
/
std-
def.h
as the type
unsigned short
.
Store positions in memory
The positions in the memory where data is stored depend on the data type. The
short
and
int
type variables
are aligned at 2-byte boundary addresses, and the
long
and
double
type variables are aligned at 4-byte
boundary addresses.
Structure data
Structure data is located in the memory beginning with a 4-byte boundary address. Members are located in the
memory according to the size of each data type in the order they are defined.
The following shows an example of how structure is defined, and where it is located.
Example:
struct Sample {
char
cData;
short
sData;
char
cArray[3];
long
lData;
};
Low memory
+0
+1
+2
+3
cData
Start address
Unused
cArray[3]
lData
+8
+4
+0
Unused
sData
Figure 6.4.2.1 Sample locations of structure data in the memory
As shown in the diagram above, some unused areas may remain in the memory depending on the data type of a
member.
C language specifications permit implementation-defined adjustment of the method of configuring member
variables of a structure or union.
Содержание S5U1C17001C
Страница 6: ......
Страница 17: ...1 General S5U1C17001C Manual 1 General ...
Страница 18: ......
Страница 21: ...1 2 Install S5U1C17001C Manual 2 Installation ...
Страница 22: ......
Страница 29: ...3 SoftDev S5U1C17001C Manual 3 Software Development Procedures ...
Страница 30: ......
Страница 103: ...4 SrcFiles S5U1C17001C Manual 4 Source files ...
Страница 104: ......
Страница 121: ...5 IDE S5U1C17001C Manual 5 gnU17 iDE ...
Страница 122: ......
Страница 365: ...6 Compiler S5U1C17001C Manual 6 C Compiler ...
Страница 366: ......
Страница 385: ...7 Library S5U1C17001C Manual 7 library ...
Страница 386: ......
Страница 404: ...7 18 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 7 liBrary THIS PAGE IS BLANK ...
Страница 405: ...8 Assemblr S5U1C17001C Manual 8 assembler ...
Страница 406: ......
Страница 438: ...8 32 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 8 aSSEMBlEr THIS PAGE IS BLANK ...
Страница 439: ...9 Linker S5U1C17001C Manual 9 linker ...
Страница 440: ......
Страница 448: ...9 8 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 9 linkEr THIS PAGE IS BLANK ...
Страница 449: ...10 Debugger S5U1C17001C Manual 10 Debugger ...
Страница 450: ......
Страница 625: ...10 174 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 10 DEBUggEr THIS PAGE IS BLANK ...
Страница 626: ...11 Tools S5U1C17001C Manual 11 Other Tools ...
Страница 627: ......
Страница 695: ...11 68 EPSON S5U1C17001C Manual C Compiler Package for S1C17 Family Ver 1 5 0 11 OTHEr TOOlS THIS PAGE IS BLANK ...
Страница 696: ...S1C17 Family C Compiler Package Quick Reference Reference ...