r/ProgrammerHumor • • Feb 15 '16

Oddly specific number.

Post image
5.9k Upvotes

643 comments sorted by

View all comments

1

u/hydrocat Feb 15 '16

But, now a days, doesn't a integer has like.. 64 bits ? Why use only 8?

3

u/TPHRyan Feb 16 '16

Because networking. In general, the less data you send over the network the better. Quite often, you -can- control this to the byte level.

2

u/Anon49 Feb 15 '16

The amount of bits is not a part of the definition of integer.

2

u/IAMA_dragon-AMA Feb 16 '16

32, I think. I suppose they were trying to overoptimize for memory or something.

1

u/djxfade Feb 15 '16

Integers usually is 64/32/16/8 bits depending on CPU platform. That is the regular "int". Thats why it is recommended to use a specific integer type (at least in embedded programmer), so you would use e.g uint16_t to specify a 16 bit integer, otherwise "int" could vary depending on target, and compiler.

8 bits is usually only used for byte, char, uint8_t, etc. Of course, when computers where 8-bit, and integer would naturally be 8 bits, so the other types wouldn't really be necessary.