ISO C++ forbids cast to non-reference type used as lvalue ?

Robert P. J. Day rpjday@mindspring.com
Wed Jul 13 16:37:00 GMT 2005


On Wed, 13 Jul 2005, Daniel Kegel wrote:

> Robert P. J. Day wrote:
> > > >    (DWORD *) pbData += 1;
> > > >
> > > > How could I workaround that, i.e. is there a flag to shut up the
> > > > compiler?
> > >
> > > No.  Fix your code.  Sorry.  Yes, it's painful.
> >
> >
> > i ran into precisely this problem trying to compile "openembedded"
> > with gcc4, and found out that the module utils code uses that lvalue
> > casting in places, which means you can't compile openembedded with
> > gcc4.  drat.
> >
> > obviously, one can clean up one's *own* code, but it's more
> > troublesome when kernel and kernel-related code uses that now-illegal
> > construct.
>
> Yes, but the path is clear:
>
> 1) check the project's newer versions or CVS to see if somebody
> has already submitted fixes.  (This is likely now that fc4 is using gcc4,
> and will be even more likely now that Debian is switching, too.)
> If so, move to the newer version
> or take the fixes as a patch to your older version.
>
> 2) Otherwise, start fixing problems, and sending patches upstream.
>
> Easy beans.  It just takes a little elbow grease.  Oh,
> and you get to learn a lot more about the C++ standard :-)

oh, i didn't suggest it was insurmountable.  it just means we're going
to see, in short order, where lots of folks cut corners with their C
coding for a long time. :-P

rday

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list