数据类型从哪里获取名称?

时间:2022-02-15 17:14:22

Why is a bit, called a bit. Why is a 8-bits a Byte? What made people call a 16-bits a Word, and so on. Where and why did their alias come about?

为什么有点,称为一点。为什么8位是一个字节?是什么让人们称之为16位字,依此类推。他们的别名在何处以及为何出现?

I would love other people to include things like basic ASM types, then branch out to C/C++ and move on to SQL and the like's datatypes.

我希望其他人能够包含基本ASM类型之类的东西,然后分支到C / C ++并继续使用SQL等类型的数据类型。

  1. 1-Bit
    1. Bit - binary Unit
    2. 位 - 二进制单位

    3. Bool - Named after the inventor of boolen logic George Boole.
    4. Bool - 以窃听逻辑George Boole的发明者命名。

  2. 1位比特 - 二进制单元布尔 - 以窃听逻辑乔治布勒的发明者命名。

  3. 4-Bits
    1. Nibble - Half the size of bite/byte.
    2. 半字节 - 咬/字节大小的一半。

  4. 4位半字节 - 咬/字节大小的一半。

  5. 8-Bits
    1. Byte - Coined from "bite" but respelled to avoid accidental mutation to "bit".
    2. 字节 - 从“叮咬”中创造出来,但是为了避免意外突变而“被摧毁”。

    3. Char
    4. Octet - Is a grouping of eight bits, from the Latin "octo" meaning "eight".
    5. 八位组 - 是一组八位,来自拉丁语“octo”,意思是“八”。

  6. 8位字节 - 由“咬”创造,但被驱逐以避免意外突变为“位”。 Char Octet - 是一个八位的分组,来自拉丁语“octo”,意思是“八”。

  7. 16-Bits
    1. Word (unsigned integer)
    2. 字(无符号整数)

    3. short (signed integer)
    4. 短(有符号整数)

  8. 16位字(无符号整数)短(有符号整数)

  9. 32-Bits
    1. Double Word
    2. int (signed integers)
    3. int(有符号整数)

    4. unsigned (unsigned integer)
    5. 无符号(无符号整数)

    6. float (4-byte float)
    7. float(4字节浮点数)

  10. 32位双字int(有符号整数)无符号(无符号整数)浮点数(4字节浮点数)

6 个解决方案

#1


13  

Wikipedia is your friend:

*是你的朋友:

  • bit
  • nibble
  • byte
  • "char" is just short for "character"
  • “char”只是“角色”的缩写

  • "short" is an alias for "short int"
  • “short”是“short int”的别名

  • word "is the native or most efficient size the CPU can handle" (thanks to Tony for pointing that out).
  • 单词“是CPU可以处理的本机或最有效的大小”(感谢Tony指出这一点)。

  • "int" is short for "integer". The size is undefined (can be 16, 32 or 64 bits).
  • “int”是“整数”的缩写。大小未定义(可以是16位,32位或64位)。

  • "float" is short for "floating point number"
  • “float”是“浮点数”的缩写

  • "double" is short for "double precision floating point number"
  • “double”是“双精度浮点数”的缩写

#2


3  

One that Aaron forgot was Bool: This goes back to the logician Boole, who is attributed the invention of "boolean" logic.

Aaron忘记的一个是Bool:这可以追溯到逻辑学家Boole,后者归功于“布尔”逻辑的发明。

#3


2  

  • A bit is a binary digit.
  • 一位是二进制数字。

  • A float should be clear (floating point semantics)
  • 浮点应该是清楚的(浮点语义)

The rest, I could only guess

其余的,我只能猜测

#4


1  

I always thought 8 bits is called Octet, you live and learn. ;)

我一直以为8位被称为Octet,你生活和学习。 ;)

#5


0  

Probably you may ask: Why is m called as meter? Why is 1km represented by 1000m?

也许你可能会问:为什么m被称为米?为什么1公里代表1000米?

Tought question... Think it in simple way. Don't get yourself into tense.

问题......以简单的方式思考。不要让自己陷入紧张。

#6


0  

Your convention of short/int/long/word/dword for signed is not just an x86-ism; it's a Windows-ism (SHORT/LONG/WORD/DWORD). I don't see why Windows programmers like them so much when the standard (u)intN_t types are more clear to pretty much everyone.

您签署的short / int / long / word / dword约定不仅仅是x86-ism;这是一个Windows-ism(SHORT / LONG / WORD / DWORD)。当标准(u)intN_t类型对每个人都更清楚时,我不明白为什么Windows程序员会喜欢它们。

I don't think x86 naturally comes with "word" and "double word"; registers are al,ah (8-bit), ax (16-bit), eax (32-bit). I forget how you specify the size of a memory-memory move, though.

我不认为x86自然带有“单词”和“双字”;寄存器是al,ah(8位),ax(16位),eax(32位)。但我忘记了如何指定内存移动的大小。

M68K instructions have .b (byte), .w (word), and .l (long) suffixes. No double/quad-word IIRC.

M68K指令具有.b(字节),. w(字)和.l(长)后缀。没有双/四字IIRC。

ARM has ldb (byte), ldh (halfword), ldr (register).

ARM有ldb(字节),ldh(半字),ldr(寄存器)。

PPC has byte, halfword, word, and doubleword IIRC.

PPC具有字节,半字,字和双字IIRC。

In general, it's pretty meaningless to talk about "word size", since it's highly architecture-dependent, and even then it tends to change (I doubt that modern x86 implements 16-bit arithmetic any faster than 32-bit arithmetic).

一般来说,谈论“字大小”是没有意义的,因为它高度依赖于体系结构,即便如此,它也会发生变化(我怀疑现代x86比32位算术更快地实现16位算术)。

Then there's also the "pointer size" definition, but amd64 only has 48-bit virtual addresses (the top 17 bits are supposed to be all 1 or all 0).

然后还有“指针大小”定义,但amd64只有48位虚拟地址(前17位应该全部为1或全0)。

#1


13  

Wikipedia is your friend:

*是你的朋友:

  • bit
  • nibble
  • byte
  • "char" is just short for "character"
  • “char”只是“角色”的缩写

  • "short" is an alias for "short int"
  • “short”是“short int”的别名

  • word "is the native or most efficient size the CPU can handle" (thanks to Tony for pointing that out).
  • 单词“是CPU可以处理的本机或最有效的大小”(感谢Tony指出这一点)。

  • "int" is short for "integer". The size is undefined (can be 16, 32 or 64 bits).
  • “int”是“整数”的缩写。大小未定义(可以是16位,32位或64位)。

  • "float" is short for "floating point number"
  • “float”是“浮点数”的缩写

  • "double" is short for "double precision floating point number"
  • “double”是“双精度浮点数”的缩写

#2


3  

One that Aaron forgot was Bool: This goes back to the logician Boole, who is attributed the invention of "boolean" logic.

Aaron忘记的一个是Bool:这可以追溯到逻辑学家Boole,后者归功于“布尔”逻辑的发明。

#3


2  

  • A bit is a binary digit.
  • 一位是二进制数字。

  • A float should be clear (floating point semantics)
  • 浮点应该是清楚的(浮点语义)

The rest, I could only guess

其余的,我只能猜测

#4


1  

I always thought 8 bits is called Octet, you live and learn. ;)

我一直以为8位被称为Octet,你生活和学习。 ;)

#5


0  

Probably you may ask: Why is m called as meter? Why is 1km represented by 1000m?

也许你可能会问:为什么m被称为米?为什么1公里代表1000米?

Tought question... Think it in simple way. Don't get yourself into tense.

问题......以简单的方式思考。不要让自己陷入紧张。

#6


0  

Your convention of short/int/long/word/dword for signed is not just an x86-ism; it's a Windows-ism (SHORT/LONG/WORD/DWORD). I don't see why Windows programmers like them so much when the standard (u)intN_t types are more clear to pretty much everyone.

您签署的short / int / long / word / dword约定不仅仅是x86-ism;这是一个Windows-ism(SHORT / LONG / WORD / DWORD)。当标准(u)intN_t类型对每个人都更清楚时,我不明白为什么Windows程序员会喜欢它们。

I don't think x86 naturally comes with "word" and "double word"; registers are al,ah (8-bit), ax (16-bit), eax (32-bit). I forget how you specify the size of a memory-memory move, though.

我不认为x86自然带有“单词”和“双字”;寄存器是al,ah(8位),ax(16位),eax(32位)。但我忘记了如何指定内存移动的大小。

M68K instructions have .b (byte), .w (word), and .l (long) suffixes. No double/quad-word IIRC.

M68K指令具有.b(字节),. w(字)和.l(长)后缀。没有双/四字IIRC。

ARM has ldb (byte), ldh (halfword), ldr (register).

ARM有ldb(字节),ldh(半字),ldr(寄存器)。

PPC has byte, halfword, word, and doubleword IIRC.

PPC具有字节,半字,字和双字IIRC。

In general, it's pretty meaningless to talk about "word size", since it's highly architecture-dependent, and even then it tends to change (I doubt that modern x86 implements 16-bit arithmetic any faster than 32-bit arithmetic).

一般来说,谈论“字大小”是没有意义的,因为它高度依赖于体系结构,即便如此,它也会发生变化(我怀疑现代x86比32位算术更快地实现16位算术)。

Then there's also the "pointer size" definition, but amd64 only has 48-bit virtual addresses (the top 17 bits are supposed to be all 1 or all 0).

然后还有“指针大小”定义,但amd64只有48位虚拟地址(前17位应该全部为1或全0)。