Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!gli.com!bobj From: bobj@gli.com (Robert Jacobs) Newsgroups: comp.lang.c++ Subject: pointer arithmitic on a void* Summary: Is p+1 allowable if p is a void*? Keywords: pointer arithmatic void* Message-ID: <1990Sep7.144048.2049@gli.com> Date: 7 Sep 90 14:40:48 GMT Distribution: comp.std.c Organization: General Logistics International, Inc. Lines: 21 Is the following syntax allowable in c++. The reason I ask is because a version of my compiler used to allow it but the UPGRADE forbids it. int foo(void *p,int width) { void *q; q = p+width; } The compiler complains about not knowing the size information. In order to get this to work I have to recast p to either an int or a char*. Note I am not trying to dereference a void. I know that is illegal. If pointer arithmitic is not allowed on a void* then its usefullness is much reduced. Robert Jacobs bobj@gli.com