>
>
>
What does the pointer size depend on in…

Andrey Karpov
Articles: 671

What does the pointer size depend on in C++ on different platforms?

According to the C++ standard, the pointer size depends on the particular compiler implementation and does not relate directly to the platform capacity. In its turn, within the framework of a particular standard implementation, sizes of pointers of various types (pointers to objects, pointers to functions, etc.) may also vary.

However, most contemporary operating systems of general purpose (desktop UNIX-compatible systems, MS Windows) use data models where the pointer size corresponds to the capacity of the address bus employed by the architecture of these platforms. The address bus width determines the size of addressable memory. For example, if the address bus width is 32 bits and the memory word size is one byte (the minimal addressable data amount), then the size of the addressable memory equals 2^32 bytes, which determines the optimal pointer size to be used for this platform.

References