Linked by Thom Holwerda on Mon 1st Oct 2012 22:55 UTC
Thread beginning with comment 537356
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[8]: Another optionally typed language
by TemporalBeing on Tue 2nd Oct 2012 20:22
in reply to "RE[7]: Another optionally typed language"
TemporalBeing,
"A 'char' and 'unsigned char' are typically 8-bits; however, they are by definition the smallest integral unit on the system - whether it is 1, 7, 8, 15, 64, or 128 bits."
Agreed.
But if the smallest integral unit on the system wasn't exactly an 8 bit byte, then we'd start having numerous compatibility issues such as how to implement stdint.h. Lots of code would still work if registers were just padded with more bits, but packed structures would be incompatible, which I believe is why POSIX mandates an 8 bit char.
http://stackoverflow.com/questions/6631491/why-did-posix-mandate-ch...
Of course, this doesn't rule out the existence of micro processors that only support a fixed word size > 8 bits, but they might have trouble parsing 8bit aligned structures which come in over the wire, etc.
"A 'char' and 'unsigned char' are typically 8-bits; however, they are by definition the smallest integral unit on the system - whether it is 1, 7, 8, 15, 64, or 128 bits."
Agreed.
But if the smallest integral unit on the system wasn't exactly an 8 bit byte, then we'd start having numerous compatibility issues such as how to implement stdint.h. Lots of code would still work if registers were just padded with more bits, but packed structures would be incompatible, which I believe is why POSIX mandates an 8 bit char.
http://stackoverflow.com/questions/6631491/why-did-posix-mandate-ch...
Of course, this doesn't rule out the existence of micro processors that only support a fixed word size > 8 bits, but they might have trouble parsing 8bit aligned structures which come in over the wire, etc.
Agreed.
I have a digital camera at work that doesn't do byte alignment. All it means is you have to be careful how you build the structure so you can overcome its inabilities to pack to the byte. (I think its compiler only does 2 or 4 byte alignment; so no pack(1).)




Member since:
2011-01-28
TemporalBeing,
"A 'char' and 'unsigned char' are typically 8-bits; however, they are by definition the smallest integral unit on the system - whether it is 1, 7, 8, 15, 64, or 128 bits."
Agreed.
But if the smallest integral unit on the system wasn't exactly an 8 bit byte, then we'd start having numerous compatibility issues such as how to implement stdint.h. Lots of code would still work if registers were just padded with more bits, but packed structures would be incompatible, which I believe is why POSIX mandates an 8 bit char.
http://stackoverflow.com/questions/6631491/why-did-posix-mandate-ch...
Of course, this doesn't rule out the existence of micro processors that only support a fixed word size > 8 bits, but they might have trouble parsing 8bit aligned structures which come in over the wire, etc.
Edited 2012-10-02 17:18 UTC