Jump to content

  • Log In with Google      Sign In   
  • Create Account

Stroke of integer genius

  • You cannot reply to this topic
23 replies to this topic

#21 SiCrane   Moderators   -  Reputation: 9670

Like
1Likes
Like

Posted 03 March 2013 - 09:29 AM

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

Sponsor:

#22 Sik_the_hedgehog   Crossbones+   -  Reputation: 1833

Like
0Likes
Like

Posted 03 March 2013 - 09:58 PM

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.

#23 RobTheBloke   Crossbones+   -  Reputation: 2341

Like
0Likes
Like

Posted 12 March 2013 - 06:05 PM

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.



#24 Sik_the_hedgehog   Crossbones+   -  Reputation: 1833

Like
0Likes
Like

Posted 13 March 2013 - 02:21 AM

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.





PARTNERS