:: Re: [DNG] [OT] [Re: Studying C as t…
トップ ページ
このメッセージを削除
このメッセージに返信
著者: KatolaZ
日付:  
To: dng
題目: Re: [DNG] [OT] [Re: Studying C as told. (For help)
On Tue, Jun 21, 2016 at 10:16:21PM +0200, Irrwahn wrote:

[cut]

>
> >> And "there's so much broken code already you rely on" should
> >> never be an excuse to deliberately produce even more broken code.
> >
> > I wouldn't call code that assumes 8-bit bytes "broken". I'd call it "sane".
>
> Octet != byte. You yourself brought up earlier the example
> of certain outlandish hardware that uses 32-bit bytes.
>


Nono, wait guys.

1 octet == 1 byte == 8 bits

Fullstop.

The "char" type in C must be acle to contain the smallest addressable
unit of memory that can contain the basic 8-bit character set. Then,
in some architectures you can represent a "char" type with a single
byte, while (as correctly pointed out before) in some other
architectures the smallest addressable chunk of memory can be longer
that one byte, but this does not mean that "byte" is undefined. It is
the "char" type in C which is not restrictively defined, as well as
"short", "int", and "long int", for which the standard defines only
the *minimum* length (but not the maximum one). "char" has to be at
least 8 bits long, "short" has to be at least 16 bits long, "int" has
to be at least 16 bits long, and "long int" has to be at least 32 bits
long.

HND

KatolaZ

-- 
[ ~.,_  Enzo Nicosia aka KatolaZ - GLUGCT -- Freaknet Medialab  ]  
[     "+.  katolaz [at] freaknet.org --- katolaz [at] yahoo.it  ]
[       @)   http://kalos.mine.nu ---  Devuan GNU + Linux User  ]
[     @@)  http://maths.qmul.ac.uk/~vnicosia --  GPG: 0B5F062F  ] 
[ (@@@)  Twitter: @KatolaZ - skype: katolaz -- github: KatolaZ  ]