Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!ico!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Operations on pointers to void. Message-ID: <17422@haddock.ima.isc.com> Date: 15 Aug 90 23:02:04 GMT References: <1990Aug10.165644.9238@zoo.toronto.edu> <482@array.UUCP> <1990Aug12.231202.23826@druid.uucp> <174@srchtec.UUCP> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 9 In article <174@srchtec.UUCP> johnb@srchtec.UUCP (John Baldwin) writes: > void *myptr; ... *((char *)&myptr) += 3; The cast should be to `char **', and it won't work if `myptr' is a register. I think `myptr = (void *)((char *)myptr + 3);' is better, or (if all the operations are on the same datatype anyway) just make a `char *' copy of the original pointer and use it exclusively. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint