ANSI C acknowledges that the size and numeric range of the basic data types (and their various permutations) are implementation-specific and usually derive from the architecture of the host computer. For CodeGear C++, the target platform is the IBM PC family (and compatibles), so the architecture of the Intel 80x86 and the Pentium family of microprocessors governs the choices of internal representations for the various data types.
The following tables list the sizes and resulting ranges of the data types. Internal representation of numerical types shows how these types are represented internally.
32-bit data types, sizes, and ranges
Type |
Size (bits) |
Range |
Sample applications |
|
|
|
|
unsigned char |
8 |
0 <= X <= 255 |
Small numbers and full PC character set |
char |
8 |
-128 <= X <= 127 |
Very small numbers and ASCII characters |
short int |
16 |
-32,768 <= X <= 32,767 |
Counting, small numbers, loop control |
unsigned int |
32 |
0 <= X <= 4,294,967,295 |
Large numbers and loops |
int |
32 |
-2,147,483,648 <= X <= 2,147,483,647 |
Counting, small numbers, loop control |
unsigned long |
32 |
0 <= X <= 4,294,967,295 |
Astronomical distances |
enum |
32 |
-2,147,483,648 <= X <= 2,147,483,647 |
Ordered sets of values |
long |
32 |
-2,147,483,648 <= X <= 2,147,483,647 |
Large numbers, populations |
float |
32 |
1.18 ( 10^-38 < |X| < 3.40 ( 10^38 |
Scientific (7-digit) precision) |
double |
64 |
2.23 ( 10^-308 < |X| < 1.79 ( 10^308 |
Scientific (15-digit precision) |
long double |
80 |
3.37 ( 10^-4932 < |X| < 1.18 ( 10^4932 |
Financial (18-digit precision) |
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|