Search code examples
javac++typessizestructure

I wanted to know what that means"The actual size of the data types depends on the implementation."


"The actual size of the data types depends on the implementation." The above is about data types in programming languages, I wanted to know what that means.


Solution

  • The "size of the data type" refers to how many bytes of memory is used to represent objects of that type.

    "Implementation" in this context refers to implementation of the language. The "implementation" consists of many parts including the compiler, rest of the tool chain such as the linker and the assembler, the standard library, and the operating system (on systems that have such thing) and the underlying CPU architecture.

    The sentence means that the size of the data type may be different across different implementations of the language. As a practical example, the size of long int data type in the implementation of the C++ language in windows on x86_64 CPU architecture using the MSVC compiler is 4 bytes, while the size of the same type on same CPU architecture in Linux is 8 bytes.