Data Representation - Epson S5U1C17001C Manual

Cmos 16-bit single chip microcomputer, c compiler package for s1c17 family
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

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.
Data type
char
unsigned char
short
unsigned short
int
unsigned int
long
unsigned long
pointer
float
double
long long
unsigned long long
wchar_t
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
short
char
long
};
Low memory
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 ManUal
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
Table 6.4.2.1 Data type and size
Size
Effective range of a number
1
-128 to 127
1
0 to 255
2
-32768 to 32767
2
0 to 65535
2
-32768 to 32767
2
0 to 65535
4
-2147483648 to 2147483647
4
0 to 4294967295
4
0 to 16777215
4
1.175e-38 to 3.403e+38 (normalized number)
8
2.225e-308 to 1.798e+308 (normalized number)
8
-9223372036854775808 to 9223372036854775807
8
0 to 18446744073709551615
2
0 to 65535
cData;
sData;
cArray[3];
lData;
+8
+4
Start address
+0
cData
+0
EPSOn
lData
cArray[3]
Unused
Unused
sData
+1
+2
6 C COMPilEr
+3
6-9
6
Compiler

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the S5U1C17001C and is the answer not in the manual?

Table of Contents