boost - C++: digits vs bits? -


i trying understand difference of vocabulary used in c++ language between digits , bits in :

char_bit; std::numeric_limits<char>::digits; 

is there conceptual difference? maybe weird architectures? if so, called result of operator[] of std::bitset. give access bit or digit?

and current documentation of boost not help: cppint provides code digits documentation mention bits (this problem documentation, don't know whether text or code more recent.)

from this std::numeric_limits::digits reference:

the value of std::numeric_limits::digits number of digits in base-radix can represented type t without change. integer types, number of bits not counting sign bit.

and later states char result char_bit - std::numeric_limits<char>::is_signed.

and c numeric limits reference:

char_bit number of bits in byte

so normal modern computer, char 8 bits, char_bits equal 8 , digits function return either 7 or 8 depending on if char signed or not.

i agree using word "digits" is kind of confusing when getting number of bits in integer type, makes more sense floating point types:

for floating-point types, number of digits in mantissa.


and std::bitset set of bits, indexing operator give selected bit in set.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -