Re: Does sizeof(char) always equal to 1?
- From: Jack Klein <jackklein@xxxxxxxxxxx>
- Date: Sun, 22 May 2005 21:43:56 -0500
On Sun, 22 May 2005 13:18:03 +0200, "Emmanuel Delahaye"
<emdel@xxxxxxxxxxxxxx> wrote in comp.lang.c:
> Sunner Sun wrote on 22/05/05 :
> > Thank you for all your replies.
> >
> > Then, if CHAR_BIT is 16, and I want to define a variable which is 8-bit
> > byte. How can I do?
>
> You can't. The C language doesn't require that such a type exists. A
> char must be at least 8-bit width, not exactly 8-bit. In C99, the exact
> witdh types are not required. The standard only says that if the
> architecture supports them, they can exist and are named uint8_t and
> the like...
Slight correction:
The C99 standard states that if an implementation has exact width 8,
16, 32, and 64 bit types with no padding bits, and if they use 2's
complement representation for negative values in the signed variants
of these types, they MUST define the exact width types.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
.
- References:
- Does sizeof(char) always equal to 1?
- From: Sunner Sun
- Re: Does sizeof(char) always equal to 1?
- From: Sunner Sun
- Re: Does sizeof(char) always equal to 1?
- From: Emmanuel Delahaye
- Does sizeof(char) always equal to 1?
- Prev by Date: Re: Help using sprintf, wanting to make 2 byte lengths and 4 byte lengths to hex string?
- Next by Date: Fork question.
- Previous by thread: Re: Does sizeof(char) always equal to 1?
- Next by thread: Re: Does sizeof(char) always equal to 1?
- Index(es):
Relevant Pages
|