4
votes

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?

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.

  1. 1-Bit
    1. Bit - binary Unit
    2. Bool - Named after the inventor of boolen logic George Boole.
  2. 4-Bits
    1. Nibble - Half the size of bite/byte.
  3. 8-Bits
    1. Byte - Coined from "bite" but respelled to avoid accidental mutation to "bit".
    2. Char
    3. Octet - Is a grouping of eight bits, from the Latin "octo" meaning "eight".
  4. 16-Bits
    1. Word (unsigned integer)
    2. short (signed integer)
  5. 32-Bits
    1. Double Word
    2. int (signed integers)
    3. unsigned (unsigned integer)
    4. float (4-byte float)
6
Note that in C++ the number of bits a data-type occupies is implementation dependent. A char could for instance be 7 bits.Björn Pollex
AFAIK a byte is the underlying machine's native small data type. There are machines that don't have 8bit bytes.sbi
The same could be said of floats not always taking up 32 bits. But I'm just trying to get the basic data types down so I could understand why they are named in such a way. I'm hoping that people, once they understand the foundation of the datatype name will better understand how to use it.Mark Tomlin
@Space: No. char must be at least 8 bits. Btw, there are machines with char == ... == long == 32bit.Yakov Galka
The sizes you specify are wrong in a lot of languages and on a lot of hardware. For example, double word is specific to x86 (most 32-bit CPU's just define a word to be 32 bits)jalf

6 Answers

13
votes

Wikipedia is your friend:

  • bit
  • nibble
  • byte
  • "char" is just short for "character"
  • "short" is an alias for "short int"
  • word "is the native or most efficient size the CPU can handle" (thanks to Tony for pointing that out).
  • "int" is short for "integer". The size is undefined (can be 16, 32 or 64 bits).
  • "float" is short for "floating point number"
  • "double" is short for "double precision floating point number"
3
votes

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

2
votes
  • A bit is a binary digit.
  • A float should be clear (floating point semantics)

The rest, I could only guess

1
votes

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

0
votes

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

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

0
votes

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.

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.

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

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

PPC has byte, halfword, word, and doubleword 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).

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).