F
Flash Gordon
Dag-Erling Smørgrav said:I believe void * is required to be assignment compatible with any
other kind of pointer except a function pointer.
Indeed.
I believe the point Pete was making,
I believe that Pete and I are in complete agreement.
> however, is that you are not
permitted to access an object through a pointer to anything but the
object's type, a compatible type, or char.
There are several cases where the standard allows you to assign a
pointer to another pointer type (some where a cast is required) and you
are guaranteed to get what you would expect. However, those cases don't
guarantee you can read that pointer (through another pointer) as a
pointer to a different type. Specifically, void* and char* are
guaranteed to have the same representation, but pointers to structs are
not guaranteed to have the same representation as pointers to void.
> Pointers to void are not
used to access anything; they are always cast or assigned to some
other pointer type before use.
Yes, but irrelevant to what we were discussing.