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?

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;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.