[Tremor] void * handling

Monty xiphmont at xiph.org
Tue Sep 27 13:03:16 PDT 2005




On Fri, Sep 23, 2005 at 01:46:42PM -0700, win dam wrote:
> Hi All,
> 
> I'm trying to compile using Visual C++.
> In codebook.c, line 670:
>     void *ptr=s->q_val+entry*s->q_pack;
> 
> The above line results in the error:
> C2036: 'void *' : unknown size
> 
> q_val is void* so the compiler probably doesn't know
> how much to increment the address.  I'm guessing that
> it is incremented in byte units, ie if q_val is 0x100,
> then q_val += 4 would be 0x104.  However, since I
> don't know how the algorithm is supposed to work, I
> can only guess.  If it is not in byte units, can
> someone let me know?

Void * arithmetic isn't part of the original ANSI standard IIRC, but I
was under the impression everyone supported it anyway.  I may be
corrected, but I thought it got picked up by C99.

In any case, a void * pointer is assumed to be a synonym for char *.
On most general purpose CPUs, this will be a octet type pointer, but
namy specialty DSPs have non-octet char types (sometimes they still
call them bytes, sometimes not; it depends whether or not they're
conflating octet and byte).

Monty


More information about the Tremor mailing list