Apple Enterprise - NeXTanswers Support Archive
Enterprise
[Index]
[Download]


Search NeXTanswers for:

Q: How many bytes of storage do the various fundamental data types take in the NEXTSTEP implementation?

Q: What are the maximum and minimum values for the various arithmetic data types?

A:

TYPE SIZE MINIMUM MAXIMUM
char 1 byte = 8 bits -128 127
unsigned char 1 byte = 8 bits 0 255
short 2 bytes = 16 bits -32768 32767
unsigned short 2 bytes = 16 bits 0 65535
int 4 bytes = 32 bits -2147483648 2147483647
long 4 bytes = 32 bits -2147483648 2147483647
unsigned int 4 bytes = 32 bits 0 4294967295
unsigned long 4 bytes = 32 bits 0 4294967295
float 4 bytes = 32 bits 1.17549435e-38f 3.40282347e+38f
double 8 bytes = 64 bits 2.225073858507201e-308
1.797693134862316e+308

* The unsigned and signed keywords don't change the size of the type they qualify.
* Pointers occupy 4 bytes.
* The void type occupies no space.

If you happen to forget any of the sizes, you can quickly remind yourself by running gdb and typing:

print sizeof(type)

The minimum and maximum values are defined as constants in <limits.h> and <float.h>.

QA808

Valid for 1.0, 2.0, 3.0



OpenStep | Alliances | Training | Tech Support | Where to Buy