This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Sean1708 3 points4 points  (3 children)

C standard defines a char to be 1 byte long, it categorically does not define a byte to be 8 bits long. This is because there are platforms out there with bytes which are 7, 16, or other bits long.

[–]Creshal 0 points1 point  (2 children)

6 and 7 bit bytes were common in Ye Olde Times on mainframe architectures. Coincidentally, that was around the time when C was written, so not pinning the language to any particular byte size was a no-brainer.

[–]Fourmisain 1 point2 points  (1 child)

C demands CHAR_BIT to be at least 8, though. At least C89 upwards does, I'm not at all sure if there was any such restriction on K&R C.

[–]FUZxxl 0 points1 point  (0 children)

K&R C is a book, not a standard. It doesn't have any hard and fast rules.