Operations on pointers to void.

D'Arcy J.M. Cain darcy at druid.uucp
Mon Aug 13 09:12:02 AEST 1990


In article <482 at array.UUCP> colin at array.UUCP (Colin Plumb) writes:
>In article <1990Aug10.165644.9238 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>> Many compilers, especially old ones with `void *' hastily kludged in,
>> treat `void *' much like `char *'.  That is a compiler bug.
>
>Actually, gcc documents its permission of pointer arithmetic on void *
>as a feature.  I disagree.  Certainly -ansi -pedantic should complain
>about the extension.

I'll buy the argument about -pedantic but in general I think it is useful
to be able to manipulate generic data.  Things like memcpy for example.  We
know that the data can be any type but we want to treat it as bytes.  Perhaps
we need a new type which acts like void * but allows pointer arithmetic based
on the smallest data type supported by the system, usually (but not always)
a byte.

-- 
D'Arcy J.M. Cain (darcy at druid)     |
D'Arcy Cain Consulting             |   MS-DOS:  The Andrew Dice Clay
West Hill, Ontario, Canada         |   of operating systems.
+ 416 281 6094                     |



More information about the Comp.lang.c mailing list