早教吧作业答案频道 -->其他-->
为什么1Byte==8bit?
题目详情
为什么1 Byte == 8 bit?
▼优质解答
答案和解析
首先可以确定的告诉你,
C/C++的标准中,从来没有规定1byte等于8bit
.它只规定了:sizeof(char) = 1,除此之外,还有一项相关的规定就是:sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long).
但是现实中,1byte确实绝大部分都是8bit的.其源头是tcp/ip协议中,有这样的规定.
所以,除非你做的系统不准备支持tcp/ip协议,否则,依循它的协议,使用1byte=8bit是最简单的.ps:
我完整的帖一下c/c++标准中对相关概念的定义吧,以c99为例(其他版本和c++的都类似):
3.51 bit
unit of data storage in the execution environment large enough to hold an object that may
have one of two values
2 NOTE It need not be possible to express the address of each individual bit of an object.
3.61 byte
addressable unit of data storage large enough to hold any member of the basic character
set of the execution environment
2 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
3 NOTE 2 A byte is composed of a contiguous sequence of bits,
the number of which is implementation-de
C/C++的标准中,从来没有规定1byte等于8bit
.它只规定了:sizeof(char) = 1,除此之外,还有一项相关的规定就是:sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long).
但是现实中,1byte确实绝大部分都是8bit的.其源头是tcp/ip协议中,有这样的规定.
所以,除非你做的系统不准备支持tcp/ip协议,否则,依循它的协议,使用1byte=8bit是最简单的.ps:
我完整的帖一下c/c++标准中对相关概念的定义吧,以c99为例(其他版本和c++的都类似):
3.51 bit
unit of data storage in the execution environment large enough to hold an object that may
have one of two values
2 NOTE It need not be possible to express the address of each individual bit of an object.
3.61 byte
addressable unit of data storage large enough to hold any member of the basic character
set of the execution environment
2 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
3 NOTE 2 A byte is composed of a contiguous sequence of bits,
the number of which is implementation-de
看了 为什么1Byte==8bit...的网友还看了以下:
感应电动势的应用E=n△φ/△t是感生电动势的公式,因为B的变化才出现了感应电动势,为什么不写成E= 2020-03-30 …
f(x)是以T为周期的函数,试求函数f(ax+b)的周期f(ax+b+T)=f(ax+b)之中,a 2020-05-12 …
关于矩阵的秩的问题题:设A为4×3矩阵,B为3×4矩阵,且R(A)=2,R(B)=3,求R(AB) 2020-05-13 …
关于微积分设f(x),g(x)在[a,b]上连续,在(a,b)内可微,证明存在t∈(a,b),使f 2020-06-10 …
我发现傅里叶变换的巨大错误!先看两条结论:1.x(t)*h(t)的傅里叶级数系数为T·a(k)·b 2020-07-13 …
有关极限的算法a^t-b^t/t如何能化简出答案为lna/b.a^t-b^t/t如何能化简出答案为 2020-07-30 …
方程ax+b=0的解集为A.若A为空集,则a,b满足的条件为;若A为有限集,则a,b满足的条件为. 2020-07-30 …
一个关于矩阵的小问题A,B为两个n阶对称矩阵,证明:AB为对称矩阵的充要条件是AB=BA.证:若A 2020-08-02 …
f(t)=定积分(定积分上下限分别为0和t,被积函数为x^3+a*x+3a-b),题中说f(t)为 2020-08-02 …
等值演算法?幕等律:A或A为什么会等价A.吸收律:A或(A与B)等价A是为什么.同一律:A或F为什么 2020-11-27 …
相关搜索:为什么1Byte==8bit