Whats a low-order byte or an high-order byte?

Sep 2, 2011 at 2:48pm
In the C Reference Manual, Denis Ritchie says, "...a character constant of length 1 has the code for the given characters in the low byte and 0 in the high order byte..."
What does this mean?
Sep 2, 2011 at 2:54pm
The text must be outdated and refer to some prototype of C. In modern C, "character" and "byte" are synonyms, so the sentence is meaningless.
Sep 2, 2011 at 3:00pm
But,in practical, is there any concept of low order byte or high order byte?
Sep 2, 2011 at 3:05pm
Not when talking about characters. When talking about multibyte values, the low order byte is the least significant byte. As an analogy with the decimal system, in the number "1024", "4" is the least significant digit.
Sep 2, 2011 at 3:25pm
The char literal size is a C versus C++ issue

From http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
For example, character literals such as 'a' are of type int in C and of type char in C++, which means that sizeof 'a' will generally give different results in the two languages: in C++ it will be 1 in C it will be sizeof(int) which on architectures with 8 bit wide char will be at least 2.

Last edited on Sep 2, 2011 at 3:26pm
Sep 2, 2011 at 3:31pm
Huh. Kind of weird, but not much of a problem. Can you think of any reason why you'd need to do sizeof('a')?
Sep 2, 2011 at 3:42pm
*
*

Also he says that characters occupy the right most seven bytes of any 8-bit byte
How can this be true and what about the first bit?

*
*
Last edited on Sep 2, 2011 at 3:52pm
Sep 2, 2011 at 3:48pm
Characters (declared, and hereinafter called, char) are chosen from the ASCII set; they occupy the rightmost seven bits of an 8-bit byte. It is also possible to interpret chars as signed, 2’s complement 8-bit numbers.
It's talking about the the ASCII character set, not about characters themselves. ASCII only needs 7 bits.

the right most seven bytes of any 8-bit byte
Don't confuse bytes and bits. They're very different things.
Sep 2, 2011 at 3:53pm
But what about the first bit is my question?
Sep 2, 2011 at 3:59pm
closed account (zb0S216C)
To understand High/Low-order bytes/bits, consider int as an example. int is 4 bytes in length. The 1st byte is the low-order byte, whereas the 4th byte is the high-order byte. This is the same for bits. For example, still using the int example, the 1st bit is the low-order bit, whereas the 32nd bit is the high-order bit.

Note that a Nibble (or Nyble) is 4 bit's in length. 2 nibbles make a byte. The lower-order nibble is the first 4 bits. The last 4 bits is the higher-order nibble.

Wazzak
Last edited on Sep 2, 2011 at 4:26pm
Sep 3, 2011 at 4:29am
@framework:
...The 1st byte is the low-order byte, whereas the 4th byte is the high-order byte...

What about the bytes in between them?
Sep 3, 2011 at 1:57pm
closed account (zb0S216C)
I do believe that there's no name for them; they're just the middle bytes.

Wazzak
Topic archived. No new replies allowed.