[Ffmpeg-devel] [PATCH] Chinese AVS video decoder

Roman Shaposhnik rvs
Mon Jul 3 23:11:55 CEST 2006

On Mon, 2006-07-03 at 16:51 -0400, The Wanderer wrote:
> Jan Knutar wrote:
> > On Sunday 02 July 2006 07:47, Bobby Bingham wrote:
> > 
> >>> And it's very reasonable to have such a unit be a standard type,
> >>> but I still don't think it makes much sense to call it "char"
> >>> when it apparently has nothing to do with character data as such.
> >> 
> >> But back in the day, when it was given the name "char", they seem
> >> to have only been thinking about Western European languages.  And
> >> from that view, you can fit a single character in a byte.  Though
> >> as you've noticed, that idea was rather short-sighted and shows its
> >> age now.
> > 
> > There's nothing preventing char from being 16 bits though. Or 12.
> Hmm. But isn't sizeof(foo) supposed to return the size of foo in bytes,
> by definition? 

> (I've been Googling for a copy of the C standard 


> If char is 16-bit, then either the statement
> which prompted my original question was wrong (sizeof(char) would have
> to return 2, not 1), or sizeof(foo) does not necessarily return the
> number of bytes necessary to store foo - which I thought was the entire
> point of sizeof in the first place.
  I believe it is OK for char to be 16-bit. In that case, 
sizeof(char) == 1 (as per para 3). I think the trouble
you have with understanding the semantics of sizeof stems
from the fact that you always assume bytes to be 8bits in
size. Which is not true as far as C standard is concerned.
See a definition of byte on a page 7(17) para 3.4:

  addressable unit of data storage large enough to hold any member of 
  the basic character
  set of the execution environment
  NOTE 1: It is possible to express the address of each individual byte 
          of an object uniquely.
  NOTE 2: A byte is composed of a contiguous sequence of bits, the 
         number of which is implementationdefined.
         The least significant bit is called the low-order bit; the     
         most significant bit is called the high-order bit.
  bit representation that fits in a byte

More information about the ffmpeg-devel mailing list