arithmetic on void pointers

T. William Wells bill at twwells.uucp
Tue Mar 7 15:14:00 AEST 1989


In article <1527 at ncar.ucar.edu> russ at groucho.UUCP (Russ Rew) writes:
: GNU C supports arithmetic on void pointers, but the manual implies
: that this is an extension to the C language.  I could find no
: prohibition on arithmetic on void pointers in K&R second edition.
: What does the latest dpANS document say?  Is it legal to increment a
: variable of type void* ?

When the dpANS talks about pointer arithmetic, it speaks of pointers
to an object type.  Void is an incomplete type, a pointer to void is
thus not a pointer to an object type, so a void pointer can't be used
in pointer arithmetic.

---
Bill
{ uunet | novavax } !twwells!bill
(BTW, I'm going to be looking for a new job sometime in the next
few months.  If you know of a good one, do send me e-mail.)



More information about the Comp.lang.c mailing list