Quantcast
Channel: Why is there no minimum size of bool data type? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Chris Zhang for Why is there no minimum size of bool data type?

$
0
0

Theoretically, a boolean's size need only be a single bit but in memory allocation, types need to be aligned in a way to be compatible with other types and filler bitsare sometimes used on different compilers and computer architectures so that the smallest capsule to store any data type is a byte.

Why is a boolean 1 byte and not 1 bit of size?

As per the last comment, I should add this quote from the Wikipedia article on byte:

The byte /ˈbaɪt/ is a unit of digital information in computing and telecommunications that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer[1][2] and for this reason it is the smallest addressable unit of memory in many computer architectures.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>