Operations on pointers to void.
Karl Heuer
karl at haddock.ima.isc.com
Fri Aug 17 10:47:03 AEST 1990
In article <1990Aug16.014947.1999 at druid.uucp> darcy at druid.uucp (D'Arcy J.M. Cain) writes:
>If the language supported pointer arithmetic on void * this would be
>possible. Note that GNU C does support it and I can't see any harm in it.
The potential harm is when somebody writes code like
vp = (struct foo *)vp;
... ++vp ...
without realizing that it doesn't do what was intended. (Somebody *did*
recently post code much like this, in fact.) This type of error will be
caught by the ANSI rule, which makes sense because `void' is an incomplete
type of undefined size.
Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint
More information about the Comp.lang.c
mailing list