March 15, 2004 Re: why is byte signed and char unsigned ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sigbjørn Lund Olsen | Sigbjørn Lund Olsen wrote:
> Mark T wrote:
>
>> In article <c31i17$9qv$1@digitaldaemon.com>, imr1984 says...
>>
>>> surely D has got it the wrong way round?
>>>
>>> Usually when people talk about 'bytes' they refer to areas of memory that have
>>> yet to be given a specific meaning - so a byte should be unsigned.
>>>
>>>
>>
>> I guess Walter followed Java where they are 8 bit signed integers because
>> ==============================
>> the Windows SDK uses
>> typedef unsigned char BYTE;
>
>
> While I agree in the sense that I generally think of '0 - 255' when thinking of a 'byte', it *is* consistent with the other integral types. And the Windows SDK is rarely an example to follow.
>
> Cheers,
> Sigbjørn Lund Olsen
I tend to think of a byte as a packed array of bits, which can frequently be interpreted as a 8-bit integer, signed or unsigned. But the integer interpretations are definitely a secondary overlay on the underlying meaning. And were I to assign a language specific secondary meaning, it would be that array of bits. And I don't know which end of the byte should correspond to bit[0]...but they should be sequential. Probably the 0 bit would be the left-hand bit, and the one's position, when interpreted as an int, would be the right bit.
OTOH, it's been a long time since I used a system where I used this relation much. Or could depend on it when going cross-platform.
|
March 15, 2004 Re: why is byte signed and char unsigned ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | In article <c348lp$1njk$1@digitaldaemon.com>, Manfred Nowak says... > >Mark T wrote: > >[...] >| A set of Bits >[...] >| Usually there are 8 Bits in a Byte, sometimes more >[...] > >Never thought of that! Then a byte can not only take more than eight bits, but also can be distributed over several places of storage, thereby > A byte is generally the smallest individually addressible multibit unit pf storage. It would not be spread in multiple places. Although you would go a ways to find a computer with other than 8-bit bytes, there are still 4-bit memories around. In the past I know of 7, 8, 12 and 16 bit ones with or without one or more indirectly accessible additional parity bits. >introducing the need of explicitely defining an order on them. Have you heard of big-endian and little-endian? |
March 15, 2004 Re: why is byte signed and char unsigned ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to larry cowan | On Mon, 15 Mar 2004 20:08:32 +0000, larry cowan wrote: [...] >>| A set of Bits [...] > A byte is generally the smallest individually addressible multibit unit pf storage. This is quite a better definition. > Have you heard of big-endian and little-endian? These are only philosophical derivates of an already existing strict ordering imposed on the bits. A "set of Bits" has no ordering. So that defintion should be considered plain wrong :-) So long! |
March 23, 2004 Re: why is byte signed and char unsigned ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to larry cowan | > A byte is generally the smallest individually addressible multibit unit pf storage. It would not be spread in multiple places. Although you would go a ways to find a computer with other than 8-bit bytes, there are still 4-bit memories around. In the past I know of 7, 8, 12 and 16 bit ones with or without one or more indirectly accessible additional parity bits.
Don't look that far - many popular DSP have the smallest addressable unit >8bit.
There are many 16 and 32 bit devices around.
Some DSP have more odd word sizes (like 24 bit).
|
April 02, 2004 Re: why is byte signed and char unsigned ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | "Matthew" <matthew@stlsoft.org> wrote in message news:c31uik$tfc$1@digitaldaemon.com... > Because I view a byte as an opaque unit of memory. void[] and void* fill the role of opaque memory. |
Copyright © 1999-2021 by the D Language Foundation