在服务器-客户端 api 上下文中使用位与布尔值
using bit vs boolean in sever- client api context
在服务器和客户端应用程序之间创建合同时,我们是否应该使用位来表示 bool 值以优化负载。
到目前为止,我总是在 API 中遇到布尔值。为什么我们不使用 bit
来表示此信息。
因为Byte
是许多计算机体系结构中最小的可寻址内存单元。您无法解决单个 bit
。 java.
中也没有这样的数据类型
弗罗姆维基百科:
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.
在服务器和客户端应用程序之间创建合同时,我们是否应该使用位来表示 bool 值以优化负载。
到目前为止,我总是在 API 中遇到布尔值。为什么我们不使用 bit
来表示此信息。
因为Byte
是许多计算机体系结构中最小的可寻址内存单元。您无法解决单个 bit
。 java.
弗罗姆维基百科:
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.