Re: Does sizeof(char) always equal to 1?



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
.



Relevant Pages

  • Re: Question about floats and mods...
    ... > How do some computer programs calculate the modulo of a float if ... equivalence class in number theory context (e.g., ... and no longer recall the exact syntax. ... EXCEL, it is whatever the language says it is, like in another response. ...
    (sci.math.num-analysis)
  • Re: Someone
    ... basic) in order to check my program *Binomial* exactness due to his weakness in this program language. ... After Afonso suggested to other to do exactly THAT for those who ... verify the program provided exact results he call me a LIAR. ... The error was the convention of IGNORING a LOOP before the ...
    (sci.stat.math)
  • RE: Why cant overloads take into account the return type.
    ... I think the straight answer to this question is that YES, a language can be ... implemented such that the return type can be taken into account during ... should do the same exact thing to the same exact set of inputs. ... > double FromString(string SomeValue) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Now that Bushs ignorant
    ... On 10/6/11 2:13 AM, JustWait wrote: ... the personnel you mention. ... Because you use the exact same language that other resellers are using ...
    (rec.boats)
  • Re: Now that Bushs ignorant
    ... On 10/5/2011 6:38 PM, Jimmy wrote: ... the personnel you mention. ... Because you use the exact same language that other resellers are using ...
    (rec.boats)