0

this line returns lvalue required as increment operand error message with gcc-4.7

hwrcolor c;
u8 *dest;

*(((unsigned char *)dest)++) = c;

I changed it

hwrcolor c;
u8 *dest;

*((unsigned char *)dest) = c;
dest += sizeof(c);

and

u32 * u32Dest;
hwrcolor c;
u8 *dest;

u32Dest = ((u32 *)dest);
*u32Dest = *u32Dest + 1;
*u32Dest = c;

and

u32 * u32Dest;
hwrcolor c;
u8 *dest;

u32Dest = ((u32 *)dest);
*(u32Dest++) = c;

after gcc compiles but application not work properly. Is conversion true?

2
Contributors
1
Reply
20
Views
3 Years
Discussion Span
Last Post by Mayukh_1
0

In the 1st option the answer can be fetched properly..of course you will have a lvalue error because you ++ & = operator is not arranged properly. Do this & check

(unsigned char*)dest++

and then

*((unsigned char *)dest) = c;

Edited by Mayukh_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.