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

Daniel Kegel dank@kegel.com
Wed Jul 13 14:24:00 GMT 2005


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 :-)
- Dan

------
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