• Announcements

Archived

This topic is now archived and is closed to further replies.

Integer sizes...

Recommended Posts

Noods    205
Am I correct in saying the integer size for most computers is 2 bytes? Thanks in advance. Noods

Share on other sites
Martee    476
Although this is implementation-defined in C++, it will most often be 4 bytes (on 32 bit computers).

Share on other sites
Anthracks    122
I think nowadays, unless you specify short instead of int, integers are 32-bit (or 4 bytes).
  short foo;int bar;cout << sizeof(foo) << endl; // will probably be 2cout << sizeof(bar) << endl; // will probably be 4

Anthracks

Share on other sites
jenova    122
the sizeof(int) while generally match the bit depth of the internal data bus of the CPU, since this is the most efficient way of transferring a piece of data (generally speaking). it just so happens that the most widely acclaimed processor (x86, starting at 386 and up is 32-bit). however, the Itanium is 64-bit, thus an "int" on an Itanium processor will most likely be 64-bit.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.