Re: Offset a void pointer
Jorrit Tyberghein <[email protected]> Tue, 12 Oct 2004 15:53:07 +0200
| Newsgroups | gmane.games.devel.general |
|---|---|
| Message-ID | <[email protected]> |
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, ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Gamedevlists-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-general Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=557