为什么是一个布尔值1字节而不是1位大小? [英] Why is a boolean 1 byte and not 1 bit of size?

查看:306
本文介绍了为什么是一个布尔值1字节而不是1位大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中,




  • 为什么是一个布尔值1字节而不是1位大小?

  • 为什么没有像4位或2位整数的类型?



我错过了上述事因为CPU不能处理小于一个字节的任何内容。

$

$ <$>

$ <$> In C++,

  • Why is a boolean 1 byte and not 1 bit of size?
  • Why aren't there types like a 4-bit or 2-bit integers?

I'm missing out the above things when writing an emulator for a CPU

解决方案

Because the CPU can't address anything smaller than a byte.

这篇关于为什么是一个布尔值1字节而不是1位大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆