Leijonamieli
Programmer
If the size of int is 4 bytes and long is also 4 bytes, what makes long different from int? 1 byte can have 2^8 different values so 4 bytes would be 2^32, but I thought long was 2^64. Or have I missunderstood something...
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I'm pretty sure I saw other sources talking about int being the size of a system word also, but I can't remember where...The int and unsigned int types have the size of the system word. This is two bytes (the same as short and unsigned short) in MS-DOS and 16-bit versions of Windows, and 4 bytes in 32-bit operating systems. However, portable code should not depend on the size of int.
The 2nd quote:C++ Std said:Certain aspects and operations of the abstract machine are described in this International Standard as implementation-defined (for example, sizeof(int)). These constitute the parameters of the abstract machine. Each implementation shall include documentation describing its characteristics and behavior in these respects.
The natural size, that's all.C++ Std said:Plain ints have the natural size suggested by the architecture of the execution environment;...