(void *)

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Sat Jul 27 04:31:50 AEST 1985


> I just realised a major problem with (void *). On machines like the HP-1000
> a pointer to a byte and a pointer to a word don't have the same bit-pattern.

This is true of most word-addressed machines.

> How are you supposed to deal with this without having a terribly in-efficient
> implementation of 'C'.

Why is this a problem?  That is what (void *) is specifically meant to
deal with.  Assigning to or from a (void *) datum on such a machine will
involve mapping to/from a canonical pointer representation, but that is
what (char *) is currently used for anyhow.  Presumably a (void *) would
look just like a (char *).  The main reason for different types is to
allow meaningful stricter type-checking, especially of malloc() values.



More information about the Comp.lang.c mailing list