sizeof(char)

William Ahern william at 25thandClement.com
Sat Oct 1 07:52:55 EST 2011


On Thu, Sep 29, 2011 at 10:37:59PM +0200, Dag-Erling Sm??rgrav wrote:
> Roumen Petrov <openssh at roumenpetrov.info> writes:
> > I don't know what you apply but  patch as is just say good bay on old
> > systems where char is with sizeof integer.
> 
> I suggest you read what I wrote, and the passage I quoted from the C
> standard.
> 
> To summarize: sizeof(char) == 1.  Always.  No exceptions.
> 

Just to clarify this a bit for those confused, if sizeof (char) == sizeof
(int) then sizeof (int) == 1, and CHAR_BIT >= 16.

Not only is this required by the spec, but it's fundamental to the machine
model upon which C and similar languages are based. The relationships are
never going to change.



More information about the openssh-unix-dev mailing list