Numerical Types

All numbers are stored as a series of bits (short for binary digits) in memory. On most computers, the smallest addressable chunk of memory is a byte, which is 8 bits. The size, or precision, of a number is the number of bytes needed to fully represent it. On a 32-bit machine, the most natural number is 4 bytes, which makes up a machine word. Generally, a 32-bit machine moves data around most efficiently in 32-bit word-sized chunks. In older books, you will sometimes see a relic of the old DOS days, where word means 16 bits, and double-word means 32 bits, but when I use word, it generally mean 32 bits. In a few years, we will probably all be driving 64-bit machines, and then a word will be 64 bits; it is simply the most convenient ...

Get C++ By Example: UnderC Learning Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.