News Score: Score the News, Sort the News, Rewrite the Headlines

Ask HN: Why some languages use 1 byte for boolean type

The minimum access in modern computers is 1 byte of 8 bits, which means that to losslessly change the value of an 1-bit bool you need three instructions:1. load byte at $address into $register2. use whatever native instructions there are to change just that single bit in $register - in the worst case you need multiple of them3. write byte from $register into $addressIn contrast, all modern platforms have a single "store immediate (=hardcoded in the bytecode) value" instruction, so it's either tw...

Read more at news.ycombinator.com

© News Score  score the news, sort the news, rewrite the headlines