[Flow-tools] "lvalue required as left operand of assignment" error
Steve Friedl
steve at unixwiz.net
Sun Aug 30 12:36:24 EDT 2009
On Sun, Aug 30, 2009 at 12:20:10PM +0200, gianrico wrote:
> I'm using gcc 4.4.0 in Fedora 11 and have the same error.
> I have this error in many places.
> The error is in C code like this:
>
> (char *)buf +=2;
>
> The question is that I think this should not be standard C code because the
> cast conversion is temporary.
>
> It could happen that in the "next line of code" buf is unchanged!
>
> I resolved this issue change the type of 'buf' to 'char *' instead of 'void *'.
>
> But I'M NOT SURE THAT THE CODE IT WILL BE STABLE. It should be tested.
The result of a cast is not an lvalue, so it should be done as:
buf = (void *) ( 2 + (char*)buf );
Steve
--
Stephen J Friedl | Security Consultant | UNIX Wizard | 714 694-0494
steve at unixwiz.net | Orange County, CA | Microsoft MVP | unixwiz.net
More information about the Flow-tools
mailing list