Stroke of integer genius

Started by
22 comments, last by Sik_the_hedgehog 11 years, 1 month ago

(thereby forcing char to be a byte)

You might be confused because the standards define char to be a byte, but a C or C++ byte isn't necessarily 8 bits. So while sizeof(char) must always be 1, that doesn't mean that char is required to be 8 bits.
Advertisement

No, I was going by CHAR_BIT being always 8, but it may be just POSIX after all (which indeed does seem to require it to be 8).

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

No, I was going by CHAR_BIT being always 8, but it may be just POSIX after all (which indeed does seem to require it to be 8).

Systems did exist with other char sizes:

http://en.wikipedia.org/wiki/ICT_1900_series

But IBM software compatibility forced the industry to standardise on 8bits. If anything, it was the customers that demanded an 8bit char standard (to make porting business software easier). If you happened to be building computers with 6bit chars, you'd have very quickly seen a rapid decline in sales through the early 70's. So companies chased the money, and made their chars 8bit instead. POSIX just standardised what everyone had already (mostly) been doing.

I was thinking on modern standards though (think e.g. C99, by which point the idea of a byte that isn't 8-bit is just plain ridiculous unless you're e.g. on a DSP that can handle only its word size and absolutely nothing else).

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

This topic is closed to new replies.

Advertisement