RE: SPAM-LOW: Re: Offset a void pointer
"Peter Lipson" <[email protected]> Thu, 14 Oct 2004 09:57:36 -0700
| Newsgroups | gmane.games.devel.general |
|---|---|
| Message-ID | <[email protected]> |
the other problem was that pointer arithmetic can't be done on a void* since the size of the object it points to isn't defined. One of his casts let the compiler treat it as a char* pointer - the other form did the arithmetic on a void* and then cast it to a char*. > -----Original Message----- > From: [email protected] > [mailto:[email protected]]On Behalf Of > Richard Fabian > Sent: Thursday, October 14, 2004 7:11 AM > To: [email protected] > Subject: SPAM-LOW: Re: [GD-General] Offset a void pointer > > > if you are referring to this: > > http://gcc.gnu.org/gcc-3.4/changes.html > from the section starting: > "The cast-as-lvalue extension has been removed for C++ and deprecated > for C and Objective-C. In particular, code like this: " > > then that is just that GCC has caught up with MS compilers in > dissallowing the implicit lvalue return of standard C style casts > > Still appears to be perfectly legal to cast to an explicit lvalue type... > > Please correct me if i am wrong on this... At least in my head it > certainly seems to make no sense to take out casting to a modifiable > type... > > Regarding Ola Olsson: static_cast is a little bit safer, as the types > Cavey Gerard was referring to were reasonably compatible. AFAIK > reinterpret_cast is used to allow you to do more "dodgy" casting, e.g. > between a function pointer and a float, something which static_cast > does not do... > Again, please correct me if i am wrong. > > > On Wed, 13 Oct 2004 13:42:53 +0200, Antoine Chavasse > <[email protected]> wrote: > > On Wed, 13 Oct 2004 10:23:16 +0100, Richard Fabian > <[email protected]> wrote: > > > > > > > > so really it just boils down to what you're comfortable with, with te > > > caveat that maybe you should be comfortable with using cast to lvalue. > > > > However, afaik using cast as lvalues isn't standard. > > It's deprecated now in gcc. > > > > > > > > > > ------------------------------------------------------- > > 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 > > > > > ------------------------------------------------------- > 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 > ------------------------------------------------------- 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