There is nothing stopping compilers from using an 8-byte int
other than the fact that it would probably break tons of existing code.
For the last 20 or so years, people have assumed that an int
is 4 bytes long (on x86 and amd64 CPUs, at least). While changing the size of an int
would be totally legal under the C++ standard, it would also break tons of old code that relies on the size of an int
for things like bit-twiddling. Breaking people's code isn't a good way to convince them they should keep using your compiler, and so compiler makers tend to make compilers that behave like people expect them to, even if that behavior isn't mandated by the language standard.