What the author wants to say about the size of a byte is that, quoting from Wikipedia:
The popularity of major commercial computing architectures has aided in the ubiquitous acceptance of the 8-bit size.
On the other hand, the unit of memory in C++ is given by the built-in type char
; under some implementation, a char
may not be an 8-bit memory chunk; though, in your C++ program every sizeof(T)
will be expressed in multiples of sizeof(char)
, that is equal to 1
by definition.
The number of bit in a byte for a particular implementation is recorded into the macro CHAR_BIT
, defined inside the standard header <climits>
. It is guaranteed that char
is at least 8-bits.
Finally, this is the definition of byte given by the C++ Standard (§1.7, intro.memory) :
The fundamental storage unit in the C++ memory model is the byte. A byte is at least large enough to contain
any member of the basic execution character set (2.3) and the eight-bit code units of the Unicode UTF-8
encoding form and is composed of a contiguous sequence of bits, the number of which is implementationdefined.
The least significant bit is called the low-order bit; the most significant bit is called the high-order
bit. The memory available to a C++ program consists of one or more sequences of contiguous bytes. Every
byte has a unique address.