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.
Summary of Contents for S5U1C17001C
Page 6: ......
Page 17: ...1 General S5U1C17001C Manual 1 General ...
Page 18: ......
Page 21: ...1 2 Install S5U1C17001C Manual 2 Installation ...
Page 22: ......
Page 29: ...3 SoftDev S5U1C17001C Manual 3 Software Development Procedures ...
Page 30: ......
Page 103: ...4 SrcFiles S5U1C17001C Manual 4 Source files ...
Page 104: ......
Page 121: ...5 IDE S5U1C17001C Manual 5 gnU17 iDE ...
Page 122: ......
Page 365: ...6 Compiler S5U1C17001C Manual 6 C Compiler ...
Page 366: ......
Page 385: ...7 Library S5U1C17001C Manual 7 library ...
Page 386: ......
Page 405: ...8 Assemblr S5U1C17001C Manual 8 assembler ...
Page 406: ......
Page 439: ...9 Linker S5U1C17001C Manual 9 linker ...
Page 440: ......
Page 449: ...10 Debugger S5U1C17001C Manual 10 Debugger ...
Page 450: ......
Page 626: ...11 Tools S5U1C17001C Manual 11 Other Tools ...
Page 627: ......
Page 696: ...S1C17 Family C Compiler Package Quick Reference Reference ...