Does C++, as an abstraction, support “bits” representing one of more than two values?

前端 未结 3 574
旧巷少年郎
旧巷少年郎 2021-02-14 00:23

[C++11: 1.7] talks about bytes in terms of bits:

The fundamental storage unit in the C++ memory model is the byte. A byte is at leas

3条回答
  •  温柔的废话
    2021-02-14 00:55

    3.9.1.7 says

    Types bool, char, wchar_t, and the signed and unsigned integer types are collectively called integral types.48) A synonym for integral type is integer type. The representations of integral types shall define values by use of a pure binary numeration system.49) [ Example: this International Standard permits 2’s complement, 1’s complement and signed magnitude representations for integral types. — end example ]"

    The note 49 reads

    A positional representation for integers that uses the binary digits 0 and 1, in which the values represented by successive bits are additive, begin with 1, and are multiplied by successive integral power of 2, except perhaps for the bit with the highest position. (Adapted from the American National Dictionary for Information Processing Systems.)

提交回复
热议问题