[Tremor] void * handling

Segher Boessenkool segher at kernel.crashing.org
Sat Oct 1 17:14:06 PDT 2005


> 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.

It did not.  It is an awful GCC extension (but oh so
handy sometimes).

> In any case, a void * pointer is assumed to be a synonym for char *.

It is not.  A pointer to void is required to have the
same alignment requirements and the same bit representation
as a pointer to a character type, but that is all.

In GCC, sizeof(void) == 1.  In standard C, sizeof(void)
is undefined behaviour (as void is an incomplete type).


Segher



More information about the Tremor mailing list