I have some legacy code which was usually compiled for PowerPC with GCC 3.4.4 . Now I am porting some code parts which I want to compile with the GCC 4.8.1 from MinGW. At some point in the code I found this:
// Prototypes
void foo(uint8* pData);
uint8 bar();
// Function
void foo(uint8* pData)
{
(uint8) *(pData++) = bar(); // Original Code - Doesn't work with GCC 4.8.1
*(pData++) = bar(); // Works with GCC 4.8.1
}
If I want to compile the line from the original code with the GCC 4.8.1 I get the lvalue required as left operand of assignment
error. If I get rid of the cast operator it works fine. Can someone explain why this is? Isn't that cast just redundant and shouldn't matter anyway? And why is it working with the GCC 3.4.4 ?