Re: [GD-General] Offset a void pointer
Brought to you by:
vexxed72
From: Jorrit T. <jor...@uz...> - 2004-10-12 13:54:41
|
CAVEY GERARD wrote: >Hi > >I have little question >It seems impossible to me to offset a void pointer with the += operator >can someone explain me why ? >I don t really understand the compiler here ... the left casting should >give him the memory unit size , right?Is left casting forbidden? > >void *BufferPtr; >unnsigned int stridde=5; >//doesnt compile ! >(char*)BufferPtr+=stride; >//will compile >BufferPtr=(char*)BufferPtr+stride; > > Indeed, the cast operator is not an lvalue. So you cannot use it on the left side of an '=' like that. Greetings, |