:: Re: [DNG] [OT] [Re: Studying C as t…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Irrwahn
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] [OT] [Re: Studying C as told. (For help)
On Tue, 21 Jun 2016 21:30:34 +0100, Katolaz wrote:
> Nono, wait guys.
>
> 1 octet == 1 byte == 8 bits


Not so. Although the 8-bit byte today is a de facto standard
for most of the equipment in wide use, it is not set in stone,
lest is it defined that way.

So it's actually:

1 octet == 8 bits (by definition, 'octo' is latin for 'eight')
1 byte == 1 char (as by the C standard, cf. clause 3.6)

But: 1 byte does not necessarily consist of exactly 8 bits.
(As far as the C standard is concerned, it has to consist of
*at least* 8 bits, though!)

Otherwise there couldn't exist any C implementations with
values other than 8 for the CHAR_BIT constant. Actual values
observed in the wild comprise: 8, 9, 16, 32, 36.

Admittedly, aside from some ancient machines and special
(e.g. DSP) hardware, you'll mostly encounter the 8-bit byte
variety. But that in no way changes the definitions.

If you really think otherwise, I suggest you persuade the
folks at comp.std.c and the ISO committee to change the
actual wording in the C standard to reflect your views. :-P

Regards
Urban